From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E351C433F5 for ; Thu, 14 Oct 2021 00:10:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2F15A61175 for ; Thu, 14 Oct 2021 00:10:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2F15A61175 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id B3431900003; Wed, 13 Oct 2021 20:10:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ABC62900002; Wed, 13 Oct 2021 20:10:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 983DF900003; Wed, 13 Oct 2021 20:10:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0168.hostedemail.com [216.40.44.168]) by kanga.kvack.org (Postfix) with ESMTP id 85AA9900002 for ; Wed, 13 Oct 2021 20:10:49 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 350F08249980 for ; Thu, 14 Oct 2021 00:10:49 +0000 (UTC) X-FDA: 78693112218.07.CF2054D Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf01.hostedemail.com (Postfix) with ESMTP id 211AA507EB3E for ; Thu, 14 Oct 2021 00:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hwqhlhPOT3W8YxWprAXqKn5R1vpF1HMQTFeRCeyMhDw=; b=FoKN+/qrHz5uAO/YI3Jw7+DfcS wey8+yMn4jVTVdQoGQuytIvGWdeySGGmeXw6g9Cgzuo5y39x//Bf9qZFSnjr7kpg7ByYCy+gSATky 682oPpANaPCttnbqHXfhwTYUHCodIC0TpKPuasCtPIbPzsYUecJz6k54iC6qXbUTt3Q+eSxyRyXE4 LF/4GcKiTPXlxiOSIWf0UtbgyI+K84SVRgiAzeuPHJdW8/DMbLp/ul8hfUnODBK4CJIHXwIFAIgy+ P0NEXXPdWRqWAdTnveAGZjFyh5yjv3miio+kzwuf4DIOFrjSUiw/Ey8u5DS35slALKBx3vT3XtGtW OshMlsug==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1maoIW-007uS2-Qc; Thu, 14 Oct 2021 00:08:54 +0000 Date: Thu, 14 Oct 2021 01:08:36 +0100 From: Matthew Wilcox To: Shakeel Butt Cc: Roman Gushchin , Johannes Weiner , Michal Hocko , Mel Gorman , Uladzislau Rezki , Vasily Averin , Andrew Morton , Cgroups , Linux MM , LKML Subject: Re: [PATCH] memcg: page_alloc: skip bulk allocator for __GFP_ACCOUNT Message-ID: References: <20211013194338.1804247-1-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 211AA507EB3E X-Stat-Signature: p7d64arff4rr39a58paizobtqwbazyuq Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="FoKN+/qr"; dmarc=none; spf=none (imf01.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1634170246-692715 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Oct 13, 2021 at 04:45:35PM -0700, Shakeel Butt wrote: > On Wed, Oct 13, 2021 at 4:15 PM Roman Gushchin wrote: > > > [...] > > > > > > > > Isn't it a bit too aggressive? > > > > > > > > How about > > > > if (WARN_ON_ONCE(gfp & __GFP_ACCOUNT)) > > > > > > We actually know that kvmalloc(__GFP_ACCOUNT) users exist and can > > > trigger bulk page allocator through vmalloc, so I don't think the > > > warning would be any helpful. > > > > > > > gfp &= ~__GFP_ACCOUNT; > > > > > > Bulk allocator is best effort, so callers have adequate fallbacks. > > > Transparently disabling accounting would be unexpected. > > > > I see... > > > > Shouldn't we then move this check to an upper level? > > > > E.g.: > > > > if (!(gfp & __GFP_ACCOUNT)) > > call_into_bulk_allocator(); > > else > > call_into_per_page_allocator(); > > > > If we add this check in the upper level (e.g. in vm_area_alloc_pages() > ) then I think we would need WARN_ON_ONCE(gfp & __GFP_ACCOUNT) in the > bulk allocator to detect future users. > > At the moment I am more inclined towards this patch's approach. Let's > say in future we find there is a __GFP_ACCOUNT allocation which can > benefit from bulk allocator and we decide to add such support in bulk > allocator then we would not need to change the bulk allocator callers > at that time just the bulk allocator. I agree with you. Let's apply the patch as-is.