From patchwork Thu Feb 17 00:22:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 12749181 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E358FC433EF for ; Thu, 17 Feb 2022 00:23:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 792776B0080; Wed, 16 Feb 2022 19:23:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 741426B0081; Wed, 16 Feb 2022 19:23:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 608936B0082; Wed, 16 Feb 2022 19:23:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0131.hostedemail.com [216.40.44.131]) by kanga.kvack.org (Postfix) with ESMTP id 4F8CF6B0080 for ; Wed, 16 Feb 2022 19:23:22 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1967B8249980 for ; Thu, 17 Feb 2022 00:23:22 +0000 (UTC) X-FDA: 79150372644.19.5F6E789 Received: from outbound-smtp22.blacknight.com (outbound-smtp22.blacknight.com [81.17.249.190]) by imf07.hostedemail.com (Postfix) with ESMTP id 90EC040004 for ; Thu, 17 Feb 2022 00:23:21 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp22.blacknight.com (Postfix) with ESMTPS id 771ABBACE1 for ; Thu, 17 Feb 2022 00:23:20 +0000 (GMT) Received: (qmail 23542 invoked from network); 17 Feb 2022 00:23:20 -0000 Received: from unknown (HELO stampy.112glenside.lan) (mgorman@techsingularity.net@[84.203.17.223]) by 81.17.254.9 with ESMTPA; 17 Feb 2022 00:23:20 -0000 From: Mel Gorman To: Andrew Morton Cc: Aaron Lu , Dave Hansen , Vlastimil Babka , Michal Hocko , Jesper Dangaard Brouer , LKML , Linux-MM , Mel Gorman Subject: [PATCH 4/6] mm/page_alloc: Drain the requested list first during bulk free Date: Thu, 17 Feb 2022 00:22:25 +0000 Message-Id: <20220217002227.5739-5-mgorman@techsingularity.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220217002227.5739-1-mgorman@techsingularity.net> References: <20220217002227.5739-1-mgorman@techsingularity.net> MIME-Version: 1.0 Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of mgorman@techsingularity.net designates 81.17.249.190 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none X-Rspamd-Server: rspam07 X-Rspam-User: X-Rspamd-Queue-Id: 90EC040004 X-Stat-Signature: a9zxd1gi5q99yahsmzqz9dy1ttjz8i88 X-HE-Tag: 1645057401-196001 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: Prior to the series, pindex 0 (order-0 MIGRATE_UNMOVABLE) was always skipped first and the precise reason is forgotten. A potential reason may have been to artificially preserve MIGRATE_UNMOVABLE but there is no reason why that would be optimal as it depends on the workload. The more likely reason is that it was less complicated to do a pre-increment instead of a post-increment in terms of overall code flow. As free_pcppages_bulk() now typically receives the pindex of the PCP list that exceeded high, always start draining that list. Signed-off-by: Mel Gorman Reviewed-by: Vlastimil Babka --- mm/page_alloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index dfc347a58ea6..635a4e0f70b4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1463,6 +1463,10 @@ static void free_pcppages_bulk(struct zone *zone, int count, * below while (list_empty(list)) loop. */ count = min(pcp->count, count); + + /* Ensure requested pindex is drained first. */ + pindex = pindex - 1; + while (count > 0) { struct list_head *list; int nr_pages;