Received: by 10.223.185.116 with SMTP id b49csp3871526wrg; Mon, 26 Feb 2018 07:27:58 -0800 (PST) X-Google-Smtp-Source: AH8x2267WFN9lm8D3yIojo+mCfx4dhPUKRhK+VodNMVjKpgQ/AXFA6kag/apX+JgiWB9TnoxdLt/ X-Received: by 2002:a17:902:aa81:: with SMTP id d1-v6mr10982158plr.251.1519658878384; Mon, 26 Feb 2018 07:27:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519658878; cv=none; d=google.com; s=arc-20160816; b=gSIwdCtmvtW9J9/M1571tlc1FVn5SaZj67ZLC9tbwGi59qQ0ilALnnwMEDOqkBJYAt QFkKVEBaTxdNoiAIe1Mq+Kl/dP2QiSQMKT0PWeC+TjgIArN0BlU4fpOg7VJd1/iek3Yo SkiYgiXTslLi7PaZyUurMYvAoMxavE4Zu3TsQrJIPxRej8F1uhmqgWUVkqcwaQ3fcw5L 07vccrg5LPmylKicqdP2rrcD4g8Q77xi8M1OH3lMXyFABQFtFdahmJhT+LvfUrYZQEAR sel1XfJOU7Q1jCnQDaAYdnbr7ZIf2mYZVUrAeyDMJwxxoxR97AK51H+ROzsq6KrXVan/ uOVQ== 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:arc-authentication-results; bh=5k3vKLds2Nu6cblqSTpckS+HCOpI1N7OIZ9JEDNRsOo=; b=xNppWAOb30SnH567o3/1VxLUeR8KX0Af87WNsFq2g+gRHDkQNfbxpaoxH9mWKrJg9L LebbPRrUIcJP2jIKvINXL1u1TExXwW6PwgqzPag5FSWuphSJBGDnfxzPFsH2MBHg8A9h tIGRVtuZCxXfWrB2+sp5GzAVUmp18djERoECvUvzRcJfw3GWJM8ps/jFiqhIsFvxTsk/ 5ys03LpnmDAkDdfvdyF5c+hGoCCUsBmn3wxvNEsiV30APqEb6f+te9XNfGJUDVfn6uo3 iW4G7jDTzi3EkY+TiZHBNbwABMJu/F78pk/N53RwF0CcnGTZoY/+qpspVi/KYCV8gL02 PxIg== 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 k5si5645632pgq.557.2018.02.26.07.27.43; Mon, 26 Feb 2018 07:27:58 -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 S1753180AbeBZNw4 (ORCPT + 99 others); Mon, 26 Feb 2018 08:52:56 -0500 Received: from mga04.intel.com ([192.55.52.120]:54609 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753066AbeBZNwu (ORCPT ); Mon, 26 Feb 2018 08:52:50 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2018 05:52:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,396,1515484800"; d="scan'208";a="29836362" Received: from aaronlu.sh.intel.com ([10.239.159.135]) by FMSMGA003.fm.intel.com with ESMTP; 26 Feb 2018 05:52:47 -0800 From: Aaron Lu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , Huang Ying , Dave Hansen , Kemi Wang , Tim Chen , Andi Kleen , Michal Hocko , Vlastimil Babka , Mel Gorman , Matthew Wilcox Subject: [PATCH v3 1/3] mm/free_pcppages_bulk: update pcp->count inside Date: Mon, 26 Feb 2018 21:53:44 +0800 Message-Id: <20180226135346.7208-2-aaron.lu@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180226135346.7208-1-aaron.lu@intel.com> References: <20180226135346.7208-1-aaron.lu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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..3154859cccd6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1117,6 +1117,7 @@ static void free_pcppages_bulk(struct zone *zone, int count, int batch_free = 0; bool isolated_pageblocks; + pcp->count -= count; spin_lock(&zone->lock); isolated_pageblocks = has_isolate_pageblock(zone); @@ -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