Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10419385ybi; Wed, 24 Jul 2019 22:53:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxFfq2wM3BRqhZiSNwWbpT22KTqbVKMI8m45eD+UZDr/4HL14+EcmzfTssZYWFUzcqaxfq X-Received: by 2002:a63:c748:: with SMTP id v8mr53442304pgg.418.1564034022341; Wed, 24 Jul 2019 22:53:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034022; cv=none; d=google.com; s=arc-20160816; b=Z2bsE7TGa3zHjJQWggQ3sh75UasKHBUvqRZOm4v7T2gRRD1OTEyIKH8Iegi6XVH52m MMySEAObdimzasFL5ZXaMXSXw2kgqCjzXjqWulxk3Gkuk/DgZUeB7PBix7tQeqDyUMam LMb2/Ja6BynnY8p6C5DjxexBySOb08hetwq/ndzrSmpfZ56C7jM3I5ffnYN0xnye10jm sxoMt6O0WM0TuAP0Z1sCh0Hq4dilnhB/DhivZUFKsTDVV1TW3ic1upBhf0AMKPQvbJpC uEkEsdbos5kFqBHAj9YmZGGGnP95KBNEAUzb9mNksScGuOj7C9IXYyApnVQ7AXxP110d tQEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=YCVJwLnHWTMolF6PQnVaDij0CtyOdpIfCsfNKw/ufAw=; b=A8Euq+N/O0lSDkILm+dWH5nUqRbaRtKx+JSUwEguydNBKj7aQxxt79vkMUQLtcw7ox HwVLvJPTWWjqn2EDlFbrZOL5tXxMq4hv7dsYcsxzZT9srlAvLVFwQcQfoFN4xAX1Ntxf zSqZ7M3DM2eoMy/UxSbOzQf9wn7xvldneaUH5IV5GbjOr209u0C4xWYzaKn5yI5WzgqV JALAHiTbzeEoD3FclFkjMM4l1i/MAH3XXlz8vkf0DLnrdyx8a+4B26778b5qT4M/9mwY CV8PC5lpRJ/v3PlFpP7PR7R5rEkkwE7K9KiPo+6OS/VG7pJoIUGh+L8EIa7g3wLvbL8V dbLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JnzxG+M3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16si16245595plr.94.2019.07.24.22.53.28; Wed, 24 Jul 2019 22:53:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JnzxG+M3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389353AbfGYCsi (ORCPT + 99 others); Wed, 24 Jul 2019 22:48:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:49732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388165AbfGYCsh (ORCPT ); Wed, 24 Jul 2019 22:48:37 -0400 Received: from localhost.localdomain (c-73-223-200-170.hsd1.ca.comcast.net [73.223.200.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7990F22BE8; Thu, 25 Jul 2019 02:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564022916; bh=YWxaVqhUBxhNakctl9Qk/YX4ee0cDSELqHl7XG/98z0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JnzxG+M3g1veiHLMx35BlJ7hi4YjM+QUckJY7zP4n5e9rvPCtvpWqldrs7tU3huZs hZOBCxuM8mEGlJRvz3bg3AO7O+QhhzX0By2Aw3ys0sPHaSLDvv1YFxOVg8B9xrErpp 1krPoi09vQ1iDFBWz29WXlNbysr39DZYUzdfWAFo= Date: Wed, 24 Jul 2019 19:48:35 -0700 From: Andrew Morton To: Yang Shi Cc: mhocko@suse.com, dvyukov@google.com, catalin.marinas@arm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: page_alloc: document kmemleak's non-blockable __GFP_NOFAIL case Message-Id: <20190724194835.59947a6b4df3c2ae7816470d@linux-foundation.org> In-Reply-To: <1562964544-59519-1-git-send-email-yang.shi@linux.alibaba.com> References: <1562964544-59519-1-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 13 Jul 2019 04:49:04 +0800 Yang Shi wrote: > When running ltp's oom test with kmemleak enabled, the below warning was > triggerred since kernel detects __GFP_NOFAIL & ~__GFP_DIRECT_RECLAIM is > passed in: > > ... > > The mempool_alloc_slab() clears __GFP_DIRECT_RECLAIM, kmemleak has > __GFP_NOFAIL set all the time due to commit > d9570ee3bd1d4f20ce63485f5ef05663866fe6c0 ("kmemleak: allow to coexist > with fault injection"). > > The fault-injection would not try to fail slab or page allocation if > __GFP_NOFAIL is used and that commit tries to turn off fault injection > for kmemleak allocation. Although __GFP_NOFAIL doesn't guarantee no > failure for all the cases (i.e. non-blockable allocation may fail), it > still makes sense to the most cases. Kmemleak is also a debugging tool, > so it sounds not worth changing the behavior. > > It also meaks sense to keep the warning, so just document the special > case in the comment. > > ... > > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -4531,8 +4531,14 @@ bool gfp_pfmemalloc_allowed(gfp_t gfp_mask) > */ > if (gfp_mask & __GFP_NOFAIL) { > /* > - * All existing users of the __GFP_NOFAIL are blockable, so warn > - * of any new users that actually require GFP_NOWAIT > + * The users of the __GFP_NOFAIL are expected be blockable, > + * and this is true for the most cases except for kmemleak. > + * The kmemleak pass in __GFP_NOFAIL to skip fault injection, > + * however kmemleak may allocate object at some non-blockable > + * context to trigger this warning. > + * > + * Keep this warning since it is still useful for the most > + * normal cases. > */ Comment has rather a lot of typos. I'd normally fix them but I think I'll duck this patch until the kmemleak situation is addressed, so we can add a kmemleakless long-term comment, if desired.