Received: by 10.223.185.116 with SMTP id b49csp7444803wrg; Thu, 1 Mar 2018 05:46:47 -0800 (PST) X-Google-Smtp-Source: AG47ELvQIQ9NS6XfUj3sEgbuDtP14W7DqKzoId/k2YQC57GcfQ/vjr6TnxD1QbuEA92kuibPuYdE X-Received: by 2002:a17:902:b683:: with SMTP id c3-v6mr1993663pls.154.1519912007054; Thu, 01 Mar 2018 05:46:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519912007; cv=none; d=google.com; s=arc-20160816; b=lGsRlWJcD28oHoNAKCPEi0PNtT2sJxUoQzPKW1lYDVh7/MZu1R4PSe9HdNpPvrSNGe HOCnDVpxCuAtOWNEvj4fvJWR90rDOuclCnTZJKecg11L4V+bkhLVJdhjFETVNvFyeIIX 5+jDbmm2Z4c2fmypLylGOe+xfxMYAk55or80P6ywG8fi6PA4+XDVpVO6uZUOJkPEKhq1 0gPUtyOir6wuGgbWy6veaqBknh1njz9CpRHiW0cRDgTQIialFkydrzPIYb7XCM0K7OE6 XtyB3jWNVs4UeYGc65OzO1waJjFdytTDfR1Qx6hdmyW3U4RK1bKv/vxA+euGt2J4Bscy Rg7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=xXHA7avWlT8l+MQn2RxbCuHEJ6uIj172q6cxwoB3MKM=; b=ZOivMp0J2UmRsQYWYhORrt9O4O6Y4Ij3lGcAaj1s26STuVM76sNp/H/uc4IqAakAI0 ud3Iy9JcdrSSFjlqaZ2fqOZGNb41x1RH0eLgrNb2R3Z+ahW+RtdFOXoBW/JL3nHFfx2t ZuSoLVBd5WOVkoh7zclmeZXWJ0zJ6Q65/SggWYvSGyLofHhtRSFRoI03PZVO8fI/LfdU iQswLYOxqEKuHIPPr7nGM6CJ/D59wDySk4ygnc2HEFAzrl7szPWsUNDbbb19BFex/0kx ifprHmjCbPQseX9kftpyeawqIdCywqrLb7f3OA3FYLdo+fk3ZrH5PUBtpJzp9K7hcc0d bL4g== 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 bj5-v6si2988391plb.732.2018.03.01.05.46.32; Thu, 01 Mar 2018 05:46:47 -0800 (PST) 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 S1030974AbeCANpP (ORCPT + 99 others); Thu, 1 Mar 2018 08:45:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:59538 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030801AbeCANpO (ORCPT ); Thu, 1 Mar 2018 08:45:14 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C6D56AC69; Thu, 1 Mar 2018 13:45:12 +0000 (UTC) Date: Thu, 1 Mar 2018 14:45:12 +0100 From: Michal Hocko To: Aaron Lu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Huang Ying , Dave Hansen , Kemi Wang , Tim Chen , Andi Kleen , Vlastimil Babka , Mel Gorman , Matthew Wilcox , David Rientjes Subject: Re: [PATCH v4 1/3] mm/free_pcppages_bulk: update pcp->count inside Message-ID: <20180301134512.GI15057@dhcp22.suse.cz> References: <20180301062845.26038-1-aaron.lu@intel.com> <20180301062845.26038-2-aaron.lu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180301062845.26038-2-aaron.lu@intel.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 01-03-18 14:28:43, Aaron Lu wrote: > Matthew Wilcox found that all callers of free_pcppages_bulk() currently > update pcp->count immediately after so it's natural to do it inside > free_pcppages_bulk(). > > No functionality or performance change is expected from this patch. > > Suggested-by: Matthew Wilcox > Signed-off-by: Aaron Lu Makes a lot of sense to me. Acked-by: Michal Hocko > --- > mm/page_alloc.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index cb416723538f..faa33eac1635 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -1148,6 +1148,7 @@ static void free_pcppages_bulk(struct zone *zone, int count, > page = list_last_entry(list, struct page, lru); > /* must delete as __free_one_page list manipulates */ > list_del(&page->lru); > + pcp->count--; > > mt = get_pcppage_migratetype(page); > /* MIGRATE_ISOLATE page should not go to pcplists */ > @@ -2416,10 +2417,8 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp) > local_irq_save(flags); > batch = READ_ONCE(pcp->batch); > to_drain = min(pcp->count, batch); > - if (to_drain > 0) { > + if (to_drain > 0) > free_pcppages_bulk(zone, to_drain, pcp); > - pcp->count -= to_drain; > - } > local_irq_restore(flags); > } > #endif > @@ -2441,10 +2440,8 @@ static void drain_pages_zone(unsigned int cpu, struct zone *zone) > pset = per_cpu_ptr(zone->pageset, cpu); > > pcp = &pset->pcp; > - if (pcp->count) { > + if (pcp->count) > free_pcppages_bulk(zone, pcp->count, pcp); > - pcp->count = 0; > - } > local_irq_restore(flags); > } > > @@ -2668,7 +2665,6 @@ static void free_unref_page_commit(struct page *page, unsigned long pfn) > if (pcp->count >= pcp->high) { > unsigned long batch = READ_ONCE(pcp->batch); > free_pcppages_bulk(zone, batch, pcp); > - pcp->count -= batch; > } > } > > -- > 2.14.3 > -- Michal Hocko SUSE Labs