Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4753089pxb; Thu, 14 Oct 2021 11:15:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBm8KnjEg7kVjY+j9rGbM/uQx7x5kRuV6UZlJuSQvUoLjTQaYzVNGt/cDF/LjM5smHzLH2 X-Received: by 2002:a17:907:2156:: with SMTP id rk22mr699935ejb.64.1634235300525; Thu, 14 Oct 2021 11:15:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634235300; cv=none; d=google.com; s=arc-20160816; b=YU4AJ5yVNquAVNbUeEBztcP5+dhs/0kpuuTaXljh9M0KD2F0/fpCt/FQw2+E0pxBs0 ndMVs9iwAC2BORKE+vwlJ+ijDKwnlO8Lr5cmma9ljKqKGCN8zREs7DXc+JPHDzTpS1tN c1jqNQ5redCM8euEVclEwGio5FGx68F9CZCdi5NGj0FlJikpmcei9WsS3a5RvYaZLjBi UQrFD7vIUQw5eimdFktoQs0Wv4x6jSy3a8j2QKPDtH3qPhmGe+hinD8sMo2gw4g+QLnO HYQ3AxlgIPaKgrNEhlDTPek/lxgPfRGc0cm260+fo8QGU0xp158qPneshkoLEwfrCFyD R+WA== 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=7BgPbMZUg3AHIPgZBVoqfyExpxLxFLTly+c7L8vjvng=; b=ovKJYBGtjLRVoiiPcpAQNJ5pEfP1gSJipomM+oZ/mUp+QGlAhLULfx/wD5YOzzr1OK 5r9FY2Lmf7qZLBkVPsRH0ctbMjvhXuPt3XmYLLfF02Jx0jeJCmrHnDPXd12yZtE811sF rZZ8Egn+EoSDwXnO6HwduWdel8vhbhRxzcn67NB8g/0rujkSg6Gz0rH0sNLjq0Q4NheG ZX8wEWsVMaGTst1bjj581sJONFXGBeGELDZybh9oI9REHAqB2Kg8fbyqBnDGuojRFAQg v4hf6YSyuktiaqs4adKN6KGXw8Dtrxl4Zkaftudcz/Ij35Z0Xzx/UAr48Yj0aVI/j/vq 3ptw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=EtQS7B1A; 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 sb26si4594596ejb.542.2021.10.14.11.14.29; Thu, 14 Oct 2021 11:15:00 -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=EtQS7B1A; 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 S232447AbhJNPNJ (ORCPT + 99 others); Thu, 14 Oct 2021 11:13:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230017AbhJNPND (ORCPT ); Thu, 14 Oct 2021 11:13:03 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A179C02C30A for ; Thu, 14 Oct 2021 08:01:40 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id i24so27394798lfj.13 for ; Thu, 14 Oct 2021 08:01:40 -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=ZqXa5DLNxvz4wSFKfDlGxH3jeasKRl9rds/nrizQozBeERAhPNQtO0p4F9XwKzDVL3 eROe+CGQ+oHTv/BYXQUDwzMw61RFKvJCcy1VYcjOQaZ+8iY1snksE8egCfF4S0uRv7vK P3ZWArJSGEkro0GwAWU6SB/JtdVMVTnRNuWnLeoPHAgc4pj8f77OSUbSYdLYO3QqDv8l zu9WX2vdTkNVSXXPFkg6Pe/EaFLOh1gfp0f7SHOrT2X4wQF9pPmoIdK2kJVYfXwtY7uw 6zeFL8nhBj6JpAb6XQ+kQoZawFortT6tRRqyRRguv+Q20mYzt5MEgDQMQVjoSqw4aOR0 FcRA== X-Gm-Message-State: AOAM530KESOWWLhtueRhZArJFqvuGTc8JUuVFq0BKe7D/r4y1L31GXuZ AI6KYS9M+NU996b2HzIxDkkOo/5KWl2uGbYAE6T6NQ== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.