From owner-svn-src-head@FreeBSD.ORG Sat Nov 2 21:39:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 20FEB9B; Sat, 2 Nov 2013 21:39:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B28E829EE; Sat, 2 Nov 2013 21:39:24 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id rA2LdJ4Q053254; Sat, 2 Nov 2013 23:39:19 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua rA2LdJ4Q053254 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id rA2LdJTi053253; Sat, 2 Nov 2013 23:39:19 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 2 Nov 2013 23:39:19 +0200 From: Konstantin Belousov To: Jilles Tjoelker Subject: Re: svn commit: r256849 - in head/sys: kern sys Message-ID: <20131102213919.GD59496@kib.kiev.ua> References: <201310211644.r9LGirtR012470@svn.freebsd.org> <20131102211727.GA160@stack.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cHOhevsz5PKyTXvv" Content-Disposition: inline In-Reply-To: <20131102211727.GA160@stack.nl> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2013 21:39:25 -0000 --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--