Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1730967ybg; Sat, 19 Oct 2019 01:16:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQDzcWyUwfAeW83bRpQBqE7Sm6ADLWZuYZEmz/llE/WeN6/u5svpylUM4kb5mDdVe+4RIw X-Received: by 2002:a17:906:54cf:: with SMTP id c15mr12620049ejp.202.1571472977424; Sat, 19 Oct 2019 01:16:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571472977; cv=none; d=google.com; s=arc-20160816; b=RtSW7uZBZZjJ1AFOjcEvn9j42zA/xKPoYw6h5ujli+SFYH8EQY9w8KCTlcopKJeWzW yzobLsPyWpfjAB5JS1C4VhLKekgrSG51l5DcNcFeS0uMetb+2PC6MeQGBR6awzIHHcv4 Xq72DnktIUzU8kzVOkBBkZi7dogsyTCt+Mw90vM1L2MDK7AVrqLxf6smZC4EPahLoETP NDKAMt36YxVbBnL44F9YcHcMaRb0dQnVkNRMGB7DrDVtP/GAA7ng4gTXFE0X6Gm6WSP0 diPjb/+Lkf1F2oOcbHPVE8cwjcYADhGiF6TBkxyDvSm0q4wUuL4c9FycHK9haOOIbss5 YrPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=KdivXU/YvMHYVsX5ZtjYmwgBHfeMbTNckMu5kTPJZvo=; b=qrMnCh+C62DCwMm2OdIOlnv0wV+CY3QyEd1ug9Ex1iXUTRB0V6/8ibwj94Zt58tKI0 5wJzWbtT4PM4OiSk+yeLb1b8ZK58WQ+VoDfxMwCDOl/H1rzH2O6KsXJoZskH+KdCEFVk uzYHbXjLL5X51h4WVF5sg10MLhAGLEiQd8I/2d5SHA1lzH5goO/WdcSN+iGy36OmXrkC E/TaW77O1BA36jcU6gLvzqya+r8ho7ojN6/WK5buxqvhEU+aYGeyNCTvwKEyI3p9YR8U L7jJ4kwLm5qOveviF9euu9UcWBmkG0j6wg5zTssbbIBBEeDMDdjzfue2ugAtToVXIS5R z30A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si5665298edb.133.2019.10.19.01.15.54; Sat, 19 Oct 2019 01:16:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408356AbfJRK4L (ORCPT + 99 others); Fri, 18 Oct 2019 06:56:11 -0400 Received: from outbound-smtp18.blacknight.com ([46.22.139.245]:40894 "EHLO outbound-smtp18.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407543AbfJRK4J (ORCPT ); Fri, 18 Oct 2019 06:56:09 -0400 Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp18.blacknight.com (Postfix) with ESMTPS id E4F591C3283 for ; Fri, 18 Oct 2019 11:56:07 +0100 (IST) Received: (qmail 30764 invoked from network); 18 Oct 2019 10:56:07 -0000 Received: from unknown (HELO stampy.112glenside.lan) (mgorman@techsingularity.net@[84.203.19.210]) by 81.17.254.9 with ESMTPA; 18 Oct 2019 10:56:07 -0000 From: Mel Gorman To: Andrew Morton Cc: Michal Hocko , Vlastimil Babka , Thomas Gleixner , Matt Fleming , Borislav Petkov , Linux-MM , Linux Kernel Mailing List , Mel Gorman Subject: [PATCH 1/3] mm, pcp: Share common code between memory hotplug and percpu sysctl handler Date: Fri, 18 Oct 2019 11:56:04 +0100 Message-Id: <20191018105606.3249-2-mgorman@techsingularity.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191018105606.3249-1-mgorman@techsingularity.net> References: <20191018105606.3249-1-mgorman@techsingularity.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Both the percpu_pagelist_fraction sysctl handler and memory hotplug have a common requirement of updating the pcpu page allocation batch and high values. Split the relevant helper to share common code. No functional change. Signed-off-by: Mel Gorman --- mm/page_alloc.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c0b2e0306720..cafe568d36f6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7983,6 +7983,15 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *table, int write, return 0; } +static void __zone_pcp_update(struct zone *zone) +{ + unsigned int cpu; + + for_each_possible_cpu(cpu) + pageset_set_high_and_batch(zone, + per_cpu_ptr(zone->pageset, cpu)); +} + /* * percpu_pagelist_fraction - changes the pcp->high for each zone on each * cpu. It is the fraction of total pages in each zone that a hot per cpu @@ -8014,13 +8023,8 @@ int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *table, int write, if (percpu_pagelist_fraction == old_percpu_pagelist_fraction) goto out; - for_each_populated_zone(zone) { - unsigned int cpu; - - for_each_possible_cpu(cpu) - pageset_set_high_and_batch(zone, - per_cpu_ptr(zone->pageset, cpu)); - } + for_each_populated_zone(zone) + __zone_pcp_update(zone); out: mutex_unlock(&pcp_batch_high_lock); return ret; @@ -8519,11 +8523,8 @@ void free_contig_range(unsigned long pfn, unsigned int nr_pages) */ void __meminit zone_pcp_update(struct zone *zone) { - unsigned cpu; mutex_lock(&pcp_batch_high_lock); - for_each_possible_cpu(cpu) - pageset_set_high_and_batch(zone, - per_cpu_ptr(zone->pageset, cpu)); + __zone_pcp_update(zone); mutex_unlock(&pcp_batch_high_lock); } #endif -- 2.16.4