From owner-svn-src-all@freebsd.org Thu Feb 25 11:18:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26D65AB49B1; Thu, 25 Feb 2016 11:18:44 +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-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97FDA1EB1; Thu, 25 Feb 2016 11:18:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u1PBIcJR061766 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 25 Feb 2016 13:18:38 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u1PBIcJR061766 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u1PBIckm061765; Thu, 25 Feb 2016 13:18:38 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 25 Feb 2016 13:18:38 +0200 From: Konstantin Belousov To: Kristof Provost Cc: Conrad Meyer , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r296025 - head/sys/netpfil/pf Message-ID: <20160225111838.GC67250@kib.kiev.ua> References: <201602250733.u1P7Xxoh041746@repo.freebsd.org> <20160225091741.GF3003@vega.codepro.be> <20160225100757.GA67250@kib.kiev.ua> <20160225102617.GG3003@vega.codepro.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160225102617.GG3003@vega.codepro.be> User-Agent: Mutt/1.5.24 (2015-08-30) 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 autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2016 11:18:44 -0000 On Thu, Feb 25, 2016 at 11:26:18AM +0100, Kristof Provost wrote: > That's a good point. We could handle those accesses failing, but > sleeping with the PF_RULES_WLOCK held would be a bad idea. > > I suppose we could just change M_WAITOK into M_NOWAIT and return ENOMEM > if it fails. The only downside I can see is that it's more likely for a > call to fail if there's not a lot of free memory. As you rightfully noted, use of M_NOWAIT at the top-half of the kernel causes random user-visible failures, which are caused by unrelated events and its interaction with the pagedaemon activities. Typical kernel code applies somewhat more complex algorithms to e.g. calculate the memory requirements, drop the locks and alloc everything, then re-acquire the locks and recheck the conditions. > > There's actually a decent number of cases where that'd have to be done, > but it doesn't look particularly hard to do.