Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2667327pxp; Mon, 14 Mar 2022 02:09:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqWAfQ0xBBjPwI1pEJgQnCET6T7bb1PJSRYMT5RByYo1lmJ5mXVsJ/3ndHQ1mm0PUW9wm0 X-Received: by 2002:a05:6a00:808:b0:4f7:765c:7606 with SMTP id m8-20020a056a00080800b004f7765c7606mr20908611pfk.57.1647248977095; Mon, 14 Mar 2022 02:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647248977; cv=none; d=google.com; s=arc-20160816; b=h1MYvry0gnED2SMwAoytWu4YzUVIVaBv7flVlqBNLHDWXfPM9honpu/W189Ln5Z/NT vLa9RP1mjTVWLoIxqZnIMZyGQrCNFr6b5CXgmvI1h4QAYRjlnNH9NCBJFmagpQ8CsPzn k7TD8+0var1vev5sZPGgzhUVpAY0MPAT8WEG0+CbF3lcYYua7wNC+ZZTjT+Me1YiFsrA pM32NlRnF+GOC3dIi2za7AnZigfLkFbqs89pGhFgB1JUrQam1UoW/i2VHGBDe7tH0Wwp CdnZ3h3wjycVGJX0jyIAadGRGFJ3RvHDAS0AfcJ058FpbIRHUbSWg7TnPI9XhgRc19bO veUw== 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=u07J4CAvfW2rxku6j2NiK/WFDWA9v2JFm0VitAGxtws=; b=NvM+KqRZg12baD48RIsJpsc/I20Rs6hYBWwN+DkXg641u3beOsfdFsF1d+tNB0T9P7 52iwAsxGp2Q4T6nSWZe3Pl5BrCV45r2T6siL85c+0CigA22dSauFZLNiFotjqalSzA87 DowsAWzDoseuS+hVcaw4x4agp/HCIRuPfqAgO7Demk6i8nlBU6j9ew0KfSxO51Hjgstl wppZBWxdjHszesx/88gfCCeUIsoKnolMk543dv235j+DYLZ8O7xzHl4GHJUIi7+PIrs1 syPShlEyQLizg68dZOqc8AougQUBPXpEiMptMfGcCmxEcsK2nKX8nY9pd7R7WGqFzWwD DXpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=d41V6mfh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ik17-20020a170902ab1100b00151f79afd0dsi13362019plb.94.2022.03.14.02.09.23; Mon, 14 Mar 2022 02:09:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=d41V6mfh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235612AbiCMVha (ORCPT + 99 others); Sun, 13 Mar 2022 17:37:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235609AbiCMVh2 (ORCPT ); Sun, 13 Mar 2022 17:37:28 -0400 Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E40DA75C0D for ; Sun, 13 Mar 2022 14:36:19 -0700 (PDT) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-2dbc48104beso144207087b3.5 for ; Sun, 13 Mar 2022 14:36:19 -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=u07J4CAvfW2rxku6j2NiK/WFDWA9v2JFm0VitAGxtws=; b=d41V6mfhx2i6Yg04udiAe+jr0Xg8XKiB03eFBYem3zFdpWq5wbChkfHU2TjDCXW6Ek XyhQaRT61am4M/j3WEnD0t2sympFmHpcAapHq5mEw7BBvTtY1UguJyoUFWzDXxUKJs+E 1FWaIRfkCOjQLEFgGxCmsOQccQykdeS+RAsyfW76mbAXjn3+wrWKbPUdcrDqa/PGUKGB 7gwz5QxX99co85P2fUG/TAVX8HSuD44rZpuWkwHcG1noWWZ6QWUaAHDhX+JxQXMcTtah ONkjo8jvMnmHhRilLayuP76mnaaSCTkztf5xI/ffyZLCe6DlhY/fRh3TiOGzgU5wpqb/ 7K/Q== 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=u07J4CAvfW2rxku6j2NiK/WFDWA9v2JFm0VitAGxtws=; b=PC2MoyLAtDFrNiIavh7ir80mJA3C2RnOIhJNpLIiDZutYUgeD7F6k/7E8QLXfjPVOu HqgzET1RSzgWfh1oFkqlILe8Nt0+ERNFiRKeVkmR98aLlTJ+dP4A/63OT4WrgWdLLBWq 5ToDTq1OpiMaKPJEwYHNktSOFYv8f+tiHcavnMKqi168idmfFhi4MF1bA/OW1rgLELA0 sRo2JXySdy8U+PRymGtE9d+0poqubEBnz17tilBnewHdRMNtTnyJC47LU7PQ9H+fGbmk rJioCNzAxGsChZPQuIUt4K9v/xQhGC4eXnRtMrM2TBNyHI2E2US2fWI8Ha9GwrlMCOlP 6XBA== X-Gm-Message-State: AOAM5323JiHbJkk8xdJyjTZc8VctruaT8e4A6Nlt9rykU/+7cJ9y8B3/ +Baj7lVUQxgNCKcL5kEhJe4UAfzhK7oKwy7yG+pWSQ== X-Received: by 2002:a81:a743:0:b0:2dc:6eab:469a with SMTP id e64-20020a81a743000000b002dc6eab469amr16626636ywh.332.1647207378575; Sun, 13 Mar 2022 14:36:18 -0700 (PDT) MIME-Version: 1.0 References: <20220312154321.GC1189@xsang-OptiPlex-9020> <15307f8a-c202-75d8-1361-dae0146df734@suse.cz> <8f499c76-68cb-a2c3-01fd-c8759e2fd317@suse.cz> In-Reply-To: From: Eric Dumazet Date: Sun, 13 Mar 2022 14:36:07 -0700 Message-ID: Subject: Re: [mm/page_alloc] 8212a964ee: vm-scalability.throughput 30.5% improvement To: Matthew Wilcox Cc: Vlastimil Babka , kernel test robot , Mel Gorman , 0day robot , Michal Hocko , Shakeel Butt , Wei Xu , Greg Thelen , Hugh Dickins , David Rientjes , LKML , lkp@lists.01.org, "Huang, Ying" , "Tang, Feng" , zhengjun.xing@linux.intel.com, fengwei.yin@intel.com, Eric Dumazet , Andrew Morton , linux-mm Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 13, 2022 at 2:27 PM Eric Dumazet wrote: > > On Sun, Mar 13, 2022 at 2:18 PM Matthew Wilcox wrote: > > > > On Sun, Mar 13, 2022 at 02:10:12PM -0700, Eric Dumazet wrote: > > > @@ -3065,6 +3062,12 @@ static int rmqueue_bulk(struct zone *zone, > > > unsigned int order, > > > */ > > > __mod_zone_page_state(zone, NR_FREE_PAGES, -(i << order)); > > > spin_unlock(&zone->lock); > > > + list_for_each_entry_safe(page, tmp, list, lru) { > > > + if (unlikely(check_pcp_refill(page))) { > > > + list_del(&page->lru); > > > + allocated--; > > > + } > > > + } > > > > ... you'd need to adjust __mod_zone_page_state() too, right? > > Probably ! > This was only to show the basic idea, as I said, not even compiled or tested :) I can test the following: diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1804287c1b792b8aa0e964b17eb002b6b1115258..30a1abf40ea7e9104bfd24a42d9e0c8ebb152fc4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3024,7 +3024,9 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, unsigned long count, struct list_head *list, int migratetype, unsigned int alloc_flags) { + struct page *page, *tmp; int i, allocated = 0; + int free_cma_pages = 0; /* * local_lock_irq held so equivalent to spin_lock_irqsave for @@ -3032,14 +3034,10 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, */ spin_lock(&zone->lock); for (i = 0; i < count; ++i) { - struct page *page = __rmqueue(zone, order, migratetype, - alloc_flags); + page = __rmqueue(zone, order, migratetype, alloc_flags); if (unlikely(page == NULL)) break; - if (unlikely(check_pcp_refill(page))) - continue; - /* * Split buddy pages returned by expand() are received here in * physical page order. The page is added to the tail of @@ -3052,9 +3050,6 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, */ list_add_tail(&page->lru, list); allocated++; - if (is_migrate_cma(get_pcppage_migratetype(page))) - __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, - -(1 << order)); } /* @@ -3065,6 +3060,16 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, */ __mod_zone_page_state(zone, NR_FREE_PAGES, -(i << order)); spin_unlock(&zone->lock); + list_for_each_entry_safe(page, tmp, list, lru) { + if (unlikely(check_pcp_refill(page))) { + list_del(&page->lru); + allocated--; + } else if (is_migrate_cma(get_pcppage_migratetype(page))) { + free_cma_pages++; + } + } + if (free_cma_pages) + __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, -(free_cma_pages << order)); return allocated; }