Received: by 10.213.65.68 with SMTP id h4csp49534imn; Mon, 12 Mar 2018 06:23:48 -0700 (PDT) X-Google-Smtp-Source: AG47ELvxYU4HJqzocpoFXcmsNIYIitEQrO1aiNynJcGMks4iFbCEdYoaDafhvn+tgYTD6Blq4V5K X-Received: by 10.98.160.142 with SMTP id p14mr8067250pfl.134.1520861028326; Mon, 12 Mar 2018 06:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520861028; cv=none; d=google.com; s=arc-20160816; b=gwAlApQF1932P2UUmGYK2tg+tWSb9idpP+CD8x+V5KePpRtFBi3dt3eqo+4dM0uTXW ifoQIWSDhBqOLlDsoy7rXkpfZKSOcSBTaJ+3qHNhy0MsQIJcvF7lpf0b4IXZdt/AQgjG U2JnOgM6SZuVYjKeSjDykAAsnGuPa5mPxI/25Vu1iTT0WUApIHmd32Ge3YVTwJkBGdK2 UIcifKMyAwkowQHKaaaFvu2uRZsmtoyz8Qfq6so1PV12QTO7pAFrfogQM3SjZ65y17+w 7JRT7jGaA10E9ntu4hagJ9u8atHR/9umdtcZPJ1UI3A3YRWOs/3Z/Ka0DQ9S1hH2BpIt BlAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=Rk9af3xEx1QTKw4WmWoNnEVQm6sHqI1NDzQTUbmGMLg=; b=OdRdCon85fnEgZ7iADZUi9xTaZBJXWsjPhbS0BtzNymNtTmlcoVO+goc5hin13qsJx xpBkLCAd+InFLBazxszENS9HCzGIv0O2BeeNlW+G+afCu5bvqNsF/sUZtCKt5fdzBChH R7WAqBhWcH0rLOaGQxghARN/tSKV1Pig3D/8RJhF3IhqrG3zBLjpSrHL495ArjMjt+Y3 AwqDOA3abIR/AutivDK0YhM1wLRIlMkqCv8XqBEFwTQ4/e3Sfv3anO5de7SkzzgksUVg PJZzyk+0uHmGdfAq/mbYqYbB/NJtXHRYrWhsNZ5CO8bw8iMcngDPwcuwb74bbhogoorZ +/hw== 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 a1si5772612pfc.147.2018.03.12.06.23.33; Mon, 12 Mar 2018 06:23:48 -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 S1751348AbeCLNWc (ORCPT + 99 others); Mon, 12 Mar 2018 09:22:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:60765 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751229AbeCLNWb (ORCPT ); Mon, 12 Mar 2018 09:22:31 -0400 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 4487AADFD; Mon, 12 Mar 2018 13:22:30 +0000 (UTC) Subject: Re: [PATCH v4 1/3] mm/free_pcppages_bulk: update pcp->count inside To: Aaron Lu , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , Huang Ying , Dave Hansen , Kemi Wang , Tim Chen , Andi Kleen , Michal Hocko , Mel Gorman , Matthew Wilcox , David Rientjes References: <20180301062845.26038-1-aaron.lu@intel.com> <20180301062845.26038-2-aaron.lu@intel.com> From: Vlastimil Babka Message-ID: Date: Mon, 12 Mar 2018 14:22:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180301062845.26038-2-aaron.lu@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/01/2018 07:28 AM, 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. Well, it's N decrements instead of one decrement by N / assignment of zero. But I assume the difference is negligible anyway, right? > Suggested-by: Matthew Wilcox > Signed-off-by: Aaron Lu Acked-by: Vlastimil Babka > --- > 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; > } > } > >