Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3890032pxb; Wed, 13 Oct 2021 15:27:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy60TRr+C7Bp1j9Ny8J2lYPYR8x5hg2l/CK1YepsofGiEstK/gM19CDizYeSZhE4VM62APW X-Received: by 2002:a63:114:: with SMTP id 20mr1414206pgb.283.1634164061585; Wed, 13 Oct 2021 15:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634164061; cv=none; d=google.com; s=arc-20160816; b=oG09e5j55Ar2GZ50ZnT6l6dCim3DLp3zkv19tv7q8p94bzBtc3X+ThmvZJvl90Fi0g y1Gn1Ugm3xWpFzoBxcM6Nhy9U3e7w5R+eDTanEZTwFLiIDAynXX7XaXalK+Jb/rpidmG is70Xq7PYd1bAdnprTaQFhUG/ae4cqwy2VisxbTW12ayZRf5gwAlcm9Bfb7J8/VKBKBW ve/qMmloV23FmFw3/FLcFHMv1XpzUuCluIoTvwFOOsyUmlViz+qFKr/1wMXieGBBVCBN bk173W+rAcVw7thEn15v1VK1x2R4V7q/cxGmVCpuDY+2xbqVhfjRZFdTaE55zVdhrCap lq4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=I9ddwzDwjBRvjNSeQZZTZvJ2NfxDHWqyayJGGbMH5Mc=; b=mD8JgwLv5130Kz8CZRWV+5VJ25TQJDu+9z38g6SSjhDdd9M9IpJqoUVxKX7bngRYG7 UtaEUdddTHlJ4Az7QnyF0yEE7trh0eRcbs6Pf8chbqMS8GPzTAmuAOFgshXO2goU8dlj i9fvb/KKQTZM8MpJ6JEkWnOfA+i8pwTN7y69bOK5oR8SolfG4T5/nyNzHE184SJK+fNi U5x/pJdK9QUgfKQ2cGkRv/7/XTIeAE6+XunF8AVoMeSW+6bHQhGeHm39FpJ0hge2L46F 7Moh1uHES7QzIKEZABKxnhku8j/rr0EIVCsBhENAfrfBrSDoh6wCirL5Sj4y4iFPxwj9 6R0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=g+egBO0u; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si1581354plf.139.2021.10.13.15.27.28; Wed, 13 Oct 2021 15:27:41 -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=@google.com header.s=20210112 header.b=g+egBO0u; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbhJMW2a (ORCPT + 99 others); Wed, 13 Oct 2021 18:28:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229754AbhJMW22 (ORCPT ); Wed, 13 Oct 2021 18:28:28 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F34BBC061570 for ; Wed, 13 Oct 2021 15:26:23 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id d131so10084204ybd.5 for ; Wed, 13 Oct 2021 15:26:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I9ddwzDwjBRvjNSeQZZTZvJ2NfxDHWqyayJGGbMH5Mc=; b=g+egBO0u1JLmFD3nechTRv3dWXbR4MmZz3U4Tu2XhQNHpDt5Cp/41Rr8/9empDSbjJ LwTyaSGs2kCyIlQ5cWGxt4GwyEtijW3UuCi8ykujsxgRizKFdNnZkilB7Ux19W3z4gXk yoW9Gn8FJ9q4h59ecIWXUCmwt2E6skuJhARdodYpzxetPL8QM0/A9+30BzxUhSx2SImy /QlM39coka72/w8/hbx03q7tBa6oCSLHFOgWh/TgBgG+jiYkM9kqRQIq0NGkPEmH0gS+ fEs7UZWcNO+b4yX+wQcCTrC24kNsN3iEVgn44C5l5Pdsw/0kIgw1/4OBAs7tuax/gFPm tt3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I9ddwzDwjBRvjNSeQZZTZvJ2NfxDHWqyayJGGbMH5Mc=; b=UjyYXeqngW2NqErOlLoALjoKPaQ5ewL9jeJG1A3ufIkdM4sVj3DhhA2srx5wrbgM/C 0goNUHhAPycTpoBPZpWX+SRNsy6C0NAkzPPnoE0OSH/KJ0loIWUHn1R7mOVzjErx1Sw2 tS+xJIUPfT3Xu4WO+r0qxe7f7nsHZMPvZdvfpEw3du+DqLB6Zjyi2MJMDitNBwgMimWl iaqqoJO3y3/yja8YjsDvVk1wOifecW4dZQkLwkzlESw9DuzQBDiTefrM+bhR9XXPY3Sj HKu5OfPm7dwwOIWiGuBMn3sADviMk1SlfMkQ0DwM5pTeA9MxXgLI6zFld3+koDLs9/Zy iX0g== X-Gm-Message-State: AOAM530yDXehfI5M/9MwEgjQ49jGqc21FT29qvd5RgwpBaY1JXLMmrPW xCcNP4PZFE3A/0IlOG5pKTDe8PYn+ZnUo6CaUkm2Kg== X-Received: by 2002:a25:1c08:: with SMTP id c8mr2421015ybc.316.1634163983003; Wed, 13 Oct 2021 15:26:23 -0700 (PDT) MIME-Version: 1.0 References: <20211013194338.1804247-1-shakeelb@google.com> In-Reply-To: From: Shakeel Butt Date: Wed, 13 Oct 2021 15:26:11 -0700 Message-ID: Subject: Re: [PATCH] memcg: page_alloc: skip bulk allocator for __GFP_ACCOUNT To: Roman Gushchin Cc: Johannes Weiner , Michal Hocko , Mel Gorman , Uladzislau Rezki , Vasily Averin , Andrew Morton , Cgroups , Linux MM , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 13, 2021 at 3:03 PM Roman Gushchin wrote: > > On Wed, Oct 13, 2021 at 12:43:38PM -0700, Shakeel Butt wrote: > > The commit 5c1f4e690eec ("mm/vmalloc: switch to bulk allocator in > > __vmalloc_area_node()") switched to bulk page allocator for order 0 > > allocation backing vmalloc. However bulk page allocator does not support > > __GFP_ACCOUNT allocations and there are several users of > > kvmalloc(__GFP_ACCOUNT). > > > > For now make __GFP_ACCOUNT allocations bypass bulk page allocator. In > > future if there is workload that can be significantly improved with the > > bulk page allocator with __GFP_ACCCOUNT support, we can revisit the > > decision. > > > > Fixes: 5c1f4e690eec ("mm/vmalloc: switch to bulk allocator in __vmalloc_area_node()") > > Signed-off-by: Shakeel Butt > > --- > > mm/page_alloc.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > index 668edb16446a..b3acad4615d3 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -5215,6 +5215,10 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, > > unsigned int alloc_flags = ALLOC_WMARK_LOW; > > int nr_populated = 0, nr_account = 0; > > > > + /* Bulk allocator does not support memcg accounting. */ > > + if (unlikely(gfp & __GFP_ACCOUNT)) > > + goto out; > > + > > 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.