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 5FCE7C433FE for ; Thu, 14 Oct 2021 15:01:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D805D61250 for ; Thu, 14 Oct 2021 15:01:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D805D61250 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 5BF32900003; Thu, 14 Oct 2021 11:01:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 56F4D900002; Thu, 14 Oct 2021 11:01:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45D3C900003; Thu, 14 Oct 2021 11:01:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0134.hostedemail.com [216.40.44.134]) by kanga.kvack.org (Postfix) with ESMTP id 37B57900002 for ; Thu, 14 Oct 2021 11:01:33 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id ED7588249980 for ; Thu, 14 Oct 2021 15:01:32 +0000 (UTC) X-FDA: 78695356824.01.9880F3F Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by imf18.hostedemail.com (Postfix) with ESMTP id 635D9400208A for ; Thu, 14 Oct 2021 15:01:30 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id z11so27198389lfj.4 for ; Thu, 14 Oct 2021 08:01:30 -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=7BgPbMZUg3AHIPgZBVoqfyExpxLxFLTly+c7L8vjvng=; b=EtQS7B1AIWL9XFdEes5Dd/g1277fNmryyfdb+sMr26dYVhXPs2hcQ8HJVpr3gwACIM ZB9qrXIzQ4oCn+3yIYMoCKeQ39Y/9PVMkmWvGzNYfXTZX/2B+zekABjJzUSBeOqOjTZ4 PL4Q1C4V7CN5kslWMxr/cHoRzdi7s2LmYwnvkrsRR6Lvk+26uQ495rDHhKxfJWs2acgO +2ZTX9V6PdVRBNj2r8R1YHOaL40ky3yYNfQ/teOP2qx5qqZwaz/ynOyBj2B0a17/x/bO xl0N5oovJudgWPf/FH36Wml2+J9OcE/tAh87QEXuqiqX3dajD52YWwzNwc7ejn0/oEyq ckCw== 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=7BgPbMZUg3AHIPgZBVoqfyExpxLxFLTly+c7L8vjvng=; b=7K0c9ALGpS0vpwlXtu+m2yXywaEyBIH7lG/YhHgPy1t9DyoaQxw3EvVUi/FTv6bkct cKHsmTQidlZ0zYMofwFam5EbaQ17PdgqLDiNkxjCVu9SET1MiVfAtlfDyESu+s1aiAVj hRAJ7fVctpItGQE6hcaAvkxBIz2ZdAPMvRi2wUdyRxV3/AISkXGP/X3k2uyfljpEPHQf uAr+cGRnBWrj8Ocjq0fzdEGYjHQzI0OUtv7dprtpf2CU/neHQRhnPMdtE+z3P8EUyu6O iT1hbXu6NLUX4x08lbbMTKxLL1V47Pg08zHhWejDdgz4KIfNLZfrvm9SPNLQ3h7jv0iM xu5Q== X-Gm-Message-State: AOAM531lyGfhXB1HRP8eFoDq8QIkE10BT0mG3AxiW74itPQLchiJcK1M soHIcJzU3PcSmGQRl8piWH/e4aCBAZ4S1J90KEZQRA== X-Google-Smtp-Source: ABdhPJwvrMjD2HlCDGXyCG1QjW7zKaAkzlCK42+wrDhaw5k2wc7ckIjIG0TYfQIfdKlsGQwgjly31iqstdjTzhvAqT0= X-Received: by 2002:a05:651c:1793:: with SMTP id bn19mr6396501ljb.475.1634223688029; Thu, 14 Oct 2021 08:01:28 -0700 (PDT) MIME-Version: 1.0 References: <20211013194338.1804247-1-shakeelb@google.com> In-Reply-To: From: Shakeel Butt Date: Thu, 14 Oct 2021 08:01:16 -0700 Message-ID: Subject: Re: [PATCH] memcg: page_alloc: skip bulk allocator for __GFP_ACCOUNT To: Michal Hocko Cc: Johannes Weiner , Mel Gorman , Uladzislau Rezki , Vasily Averin , Roman Gushchin , Andrew Morton , Cgroups , Linux MM , LKML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 635D9400208A X-Stat-Signature: enk5zjk8nced8gf1zrzwy3a11ut3q5cc Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=EtQS7B1A; spf=pass (imf18.hostedemail.com: domain of shakeelb@google.com designates 209.85.167.49 as permitted sender) smtp.mailfrom=shakeelb@google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1634223690-84482 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 Thu, Oct 14, 2021 at 12:16 AM Michal Hocko wrote: > > On Wed 13-10-21 12:43:38, Shakeel Butt wrote: > [...] > > 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; > > Did you mean goto failed here? This would break some which do not > have any fallback. E.g. xfs_buf_alloc_pages but likely more. > > Sorry I could have been more specific when talking about bypassing the > bulk allocator. It is quite confusing because the bulk allocator > interface consists of the bulk allocator and the fallback to the normal > page allocator. > I did consider 'goto failed' here but for that I have to move __GFP_ACCOUNT check after the "Already populated array" check in the function. Basically what's the point of doing other operations (incrementing nr_populated) if we are gonna skip bulk anyways. Regarding xfs_buf_alloc_pages(), it is not using __GFP_ACCOUNT and vmalloc() is the only __GFP_ACCOUNT user at this point. So, not an issue for now but I suppose it is better to be future-proof and do the 'goto failed'. Let me know what you think.