Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3946515pxb; Wed, 13 Oct 2021 16:47:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNzbTGji5/5S/BLSjCFsm+ZUDcBh36eZHiJYrtPX6qTcRrtNOAERj7gtMb/jm3buGXp0mR X-Received: by 2002:a05:6a00:140c:b0:44b:e251:fe13 with SMTP id l12-20020a056a00140c00b0044be251fe13mr2355893pfu.10.1634168869218; Wed, 13 Oct 2021 16:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634168869; cv=none; d=google.com; s=arc-20160816; b=tcLNCS/jDNYf3yJoTOpZIGFmBKNjnITtj/tbhBA0Zkwf0C0z5mwgDFbOKAiPR4xkkL Ld9tv6FY3qL3vyTKHsNFsBy+hlBkXu16j8xnkHenwPb5lD/d4CmwID+mi1bh2XbVrTGI rixsi4Olms8dsU4rG+LJdpqShxKkjX4Gcw1C5SFwDnHtAwUJroq/YMW0QFMJltapU/hp y3KGyq53psIwd0Y1qK3JEZBX3+A7W68ajZ2hFxWeWYs8G6M9FosfTMLa4K4+Il6H/6eW OKg1uW+SSk+zRE80gZswuaoi8jPmXc5ViBADPpuWUwiBiLr3BazVaLna/TVjgMzlAmy0 93Ig== 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=MIPgO8yQiZn6tL7PQw0ynB/vmiHfdbnsw7Yxik4Gs5c=; b=zeSFaVMLzZb1iEMGKIWhHn2myyMTfa5w2ViIASNE0ZXlr/hyhrmzUDmscOa76YpjWU DV7FB9GHw4miyCLOMfBNtk7xRYLnah/WMky7jkmGqHCRDkqY7xrtRPtMWwV/t+L40Bg9 iWZEbM4wMbdMyYhW9VQrhlZqd1conuNeKYSGOk2hqDP9H+7D1LCixtJgJY15ZYMJWFTu aUJEICuHzK6RPT9RdwQnV23iHfQTHYtQSenT9qAu3u0aJlPR/H54uZRIXE1MSlsZCDCd tdlqsJR7dqclVvp3+wVGu+VhZEWkXztLH/0cO6aJOqyMQXTEuK9ZXybAGOHXQcfv7dc6 Y6qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="Zo/oxYeU"; 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 j5si1177931pjy.56.2021.10.13.16.47.35; Wed, 13 Oct 2021 16:47:49 -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="Zo/oxYeU"; 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 S229668AbhJMXrz (ORCPT + 99 others); Wed, 13 Oct 2021 19:47:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229575AbhJMXrx (ORCPT ); Wed, 13 Oct 2021 19:47:53 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30926C061746 for ; Wed, 13 Oct 2021 16:45:49 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id i24so18386750lfj.13 for ; Wed, 13 Oct 2021 16:45:49 -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=MIPgO8yQiZn6tL7PQw0ynB/vmiHfdbnsw7Yxik4Gs5c=; b=Zo/oxYeUHUiu5epy5RMTUChC69BfvR/wzXIz5N5eUMfhimDPUDYzklPhtmFozV4kR2 nql9Z92aM87i6pjK6Xmv7cDjU1nKQ8VNvISZjUcdFcl7sX54/5sivvQJF0112hHD5cAu 6FSMFfQxpW8Bhe8w72Ns8DjQaO2vBG6jBTMjYQV4l81pQMst03i4Drd2f9IF2na682+u HpGrHoNfUa0Gg0sRUqFJbuOs+PoVDiErmce946h8Kc/RfXxI9lviBiTCLqjrAlsVcFt2 tYwVoR5zv7LJqtTFU0rkKAiE4bscZAQWKs3CO77dpKj2PYCI1awVeJ1tAWTq6ZcVwPKh tq8g== 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=MIPgO8yQiZn6tL7PQw0ynB/vmiHfdbnsw7Yxik4Gs5c=; b=ILy8rP1w232C+5uyE2lyF32RT6X1YZx1uk0X89EUwSHDLfudmCRhVljAYSnXI7M0dm 9EwS4uwb8AYQkmdCCuSO7EbnhKpe7e3uBjKs/AGKJNvgcyRsez2xhXrzQxSONfvmc2OF Tc7wHYcOYU/LyQXv0qMZomCrCzhQEExeiZySae3OR5Ip2Xd/+ogMML6rEQ6FUUS3E5XY 22JXEsvKUfgTz7eNA/Ad+BG2HZKlJYhrEvtvlXWaJEEcvZAkyvJhPv3gXH6VW7NtOKVE iMSTtm4pvTvgV/Lj6OdBQSWO0q/udVlHqbCg7qYk5l7z3S4hndiP9/gwVeQeQpzKR6GR xhoA== X-Gm-Message-State: AOAM5308TEYO8iyu+syBrjcX9IYRgR55R5U3drQQEZttLICjFW8d8MhD HIVeENewfqyTiUesJgZgxSD2AGSqTyEFKFLwJ4S/FA== X-Received: by 2002:a05:6512:131b:: with SMTP id x27mr1851832lfu.210.1634168747346; Wed, 13 Oct 2021 16:45:47 -0700 (PDT) MIME-Version: 1.0 References: <20211013194338.1804247-1-shakeelb@google.com> In-Reply-To: From: Shakeel Butt Date: Wed, 13 Oct 2021 16:45:35 -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 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.