Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3963727pxb; Wed, 13 Oct 2021 17:12:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjZv4qDRAMm/au8HfT2J1jpT7ZUYGqNiiBQJuYgwRbm74en7+OiGXLvArrhSCDRA8N36Sy X-Received: by 2002:a17:90a:2ecb:: with SMTP id h11mr2724131pjs.196.1634170373903; Wed, 13 Oct 2021 17:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634170373; cv=none; d=google.com; s=arc-20160816; b=m/7T/fSZPFH8jKuMHhL95FxKFehaVlfliAAVjgi+BLDYD+jIoXFv3TmdShawQKznac So7MMi0eJkBeBnOpr0jpAE2SVYJ1nYHcCVAL117zBHy2/ZHC3MXnr94E4+wl8D/3ogWI A+rOI2gBZdoMFP66KT64jpDppngUA9v2aa0cGDw7VQLQL5goGj/QaQwmhn/spD0qYC0a cwrvFpZ1qtxc7Z/ZLWZMYNFLI8y1kn/usfD607SRJZWnBS0CusyUEJDpinUIuThJsD3D Tw+UMiHvugTMLxiac53g3b/Ph3L+42KQyxO5gr388hpdQOOJbWWNX+b9SDuPIYBT14r0 uixw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hwqhlhPOT3W8YxWprAXqKn5R1vpF1HMQTFeRCeyMhDw=; b=jxWzHJTacHXdfVxVtTL8DncngnLMr3RTtoiMtxYHbElYE8JHAm4+QN6vGjBC+0oXvw zLg+b62Hmyyb/r2nLJiaz8fnN2r06H90xAJIkpE9FVQQTWowKVKKqQTkfWMw3d2l/xSa Y6paWxu1X/xcj5kI7CubZKPl92q2/bqHT9pK6vuLX4zGD9fwGBHd2X27AOqVJAuvbwXN joYarxjWGTo2qwzcnXF/GmKLbYP+GJrvvtIkiH59qYPLPWYofuCLNNPYC0r15bMHVQYP hsDgWPYFoe7GF9hf1WyNTN7mSwOsZVs5wtxErE53zc0FFhuTerHKwGtPOUtQxG8RDi/w qxaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="FoKN+/qr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si1467661pgm.332.2021.10.13.17.12.34; Wed, 13 Oct 2021 17:12:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="FoKN+/qr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229692AbhJNAMw (ORCPT + 99 others); Wed, 13 Oct 2021 20:12:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229496AbhJNAMv (ORCPT ); Wed, 13 Oct 2021 20:12:51 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7233C061570; Wed, 13 Oct 2021 17:10:47 -0700 (PDT) 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.