From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FE11CA9EA1 for ; Fri, 18 Oct 2019 12:51:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 02FC520869 for ; Fri, 18 Oct 2019 12:51:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02FC520869 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 779648E0006; Fri, 18 Oct 2019 08:51:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72A458E0003; Fri, 18 Oct 2019 08:51:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F0F98E0006; Fri, 18 Oct 2019 08:51:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0020.hostedemail.com [216.40.44.20]) by kanga.kvack.org (Postfix) with ESMTP id 382338E0003 for ; Fri, 18 Oct 2019 08:51:23 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 79DC618016846 for ; Fri, 18 Oct 2019 12:51:22 +0000 (UTC) X-FDA: 76056891204.01.coach16_bf44887f4d59 X-HE-Tag: coach16_bf44887f4d59 X-Filterd-Recvd-Size: 3406 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Oct 2019 12:51:22 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4CE4FB3B6; Fri, 18 Oct 2019 12:51:20 +0000 (UTC) Date: Fri, 18 Oct 2019 14:51:19 +0200 From: Michal Hocko To: Mel Gorman Cc: Andrew Morton , Vlastimil Babka , Thomas Gleixner , Matt Fleming , Borislav Petkov , Linux-MM , Linux Kernel Mailing List Subject: Re: [PATCH 1/3] mm, pcp: Share common code between memory hotplug and percpu sysctl handler Message-ID: <20191018125119.GO5017@dhcp22.suse.cz> References: <20191018105606.3249-1-mgorman@techsingularity.net> <20191018105606.3249-2-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191018105606.3249-2-mgorman@techsingularity.net> User-Agent: Mutt/1.10.1 (2018-07-13) 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: On Fri 18-10-19 11:56:04, Mel Gorman wrote: > 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 Acked-by: Michal Hocko > --- > 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 > -- Michal Hocko SUSE Labs