Date: Sat, 2 Nov 2013 23:39:19 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Jilles Tjoelker <jilles@stack.nl> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r256849 - in head/sys: kern sys Message-ID: <20131102213919.GD59496@kib.kiev.ua> In-Reply-To: <20131102211727.GA160@stack.nl> References: <201310211644.r9LGirtR012470@svn.freebsd.org> <20131102211727.GA160@stack.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
--cHOhevsz5PKyTXvv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 02, 2013 at 10:17:27PM +0100, Jilles Tjoelker wrote: > On Mon, Oct 21, 2013 at 04:44:53PM +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Mon Oct 21 16:44:53 2013 > > New Revision: 256849 > > URL: http://svnweb.freebsd.org/changeset/base/256849 >=20 > > Log: > > Add a resource limit for the total number of kqueues available to the > > user. Kqueue now saves the ucred of the allocating thread, to > > correctly decrement the counter on close. >=20 > > Under some specific and not real-world use scenario for kqueue, it is > > possible for the kqueues to consume memory proportional to the square > > of the number of the filedescriptors available to the process. Limit > > allows administrator to prevent the abuse. >=20 > > This is kernel-mode side of the change, with the user-mode enabling > > commit following. >=20 > > Reported and tested by: pho > > Discussed with: jmg > > Sponsored by: The FreeBSD Foundation > > MFC after: 2 weeks >=20 > > [snip] > > + if (!chgkqcnt(cred->cr_ruidinfo, 1, lim_cur(td->td_proc, > > + RLIMIT_KQUEUES))) { > > + PROC_UNLOCK(p); > > + crfree(cred); > > + return (EMFILE); > > + } >=20 > Perhaps this error should be [ENOMEM] instead of [EMFILE] as it is > unrelated to the number of file descriptors in the process. This error > is already listed in the kqueue(2) man page but appears to be not > generated. The rlimit can then be mentioned in the man page. This is reasonable. Would you make the change yourself, please ? --cHOhevsz5PKyTXvv Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSdXEGAAoJEJDCuSvBvK1B7OoQAJCXgPt+T1ptva5Aq+xe6y8W uKUBETXreFebMPHE58SwZdFT7m8rF2RTw+uhlC+vhqZQim64j7yUydAn/CWuJ6D+ UL7BvBiUHwtsdXzfBcGw87LYaPtBxEctjU2k9yIJe0b74fj8E7erXkAMExnovf47 VFj+/4IjE3QDf4alyfDxU1051BBARcLQKmY76wUNqxFvNLr8ladeNbiJC4t9fx7i J+p8TpXI0K7bh+u6sxxgtAQd3OtJ6b9DqDrK0Sr1LrLVZVBoCJXnrnMxvl6csNyU K/W4c7gBH4XXnm3icm0maxq/e4x+ITqNup6KQ3mxEQXYlb8Bs0HfqbjnNRIfaIUC e/cXDFUg6rfqKdnIxGWHsTmf6SY3ngmSsOuKdmKhJPLlubGwWJJUxVqY3Clflbnc 6QzrZDW6EOiOdHbQfTb+NLiRYjz/ervxtUyX51vy6ADhBawI83wHmY72tQIZetEy oWv+f7Ah1uJCuolOjV0QPj1XXIfWR1WDpI7kV4UDCnMcCQsgW25ODZnqqM3NG5os jmS0x0nNgbC5CZma0f+JLTOpv6OBr3XWaKwA6Qs25Vwki2+7GNecSvAVGKPSye11 16g6VTZlKvOi01sg9LhY5mpbB+Y22LznYYHqhkKlTflKPFK/iKrS/W7E/648vCvT 11FNs2P0kUAwQkeb9Ab9 =TNae -----END PGP SIGNATURE----- --cHOhevsz5PKyTXvv--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131102213919.GD59496>