Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751137AbcC3KWp (ORCPT ); Wed, 30 Mar 2016 06:22:45 -0400 Received: from szxga05-in.huawei.com ([119.145.14.199]:15918 "EHLO szxga05-in.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750744AbcC3KWn (ORCPT ); Wed, 30 Mar 2016 06:22:43 -0400 From: He Kuang To: , , , , , CC: , , , , , , , , Subject: [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE" Date: Wed, 30 Mar 2016 10:22:07 +0000 Message-ID: <1459333327-89720-1-git-send-email-hekuang@huawei.com> X-Mailer: git-send-email 1.8.3.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.193.250] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.56FBA8E5.0013,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 57843d4e46f6e029e8f8d9a193f59198 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1308 Lines: 42 This reverts commit 998d39cb236fe464af86a3492a24d2f67ee1efc2. When local irq is disabled, a percpu variable does not change, so we can remove the access macros and let the compiler optimize the code safely. Signed-off-by: He Kuang --- mm/page_alloc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 59de90d..4575b82 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2015,11 +2015,10 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp) { unsigned long flags; - int to_drain, batch; + int to_drain; local_irq_save(flags); - batch = READ_ONCE(pcp->batch); - to_drain = min(pcp->count, batch); + to_drain = min(pcp->count, pcp->batch); if (to_drain > 0) { free_pcppages_bulk(zone, to_drain, pcp); pcp->count -= to_drain; @@ -2217,9 +2216,8 @@ void free_hot_cold_page(struct page *page, bool cold) list_add_tail(&page->lru, &pcp->lists[migratetype]); pcp->count++; if (pcp->count >= pcp->high) { - unsigned long batch = READ_ONCE(pcp->batch); - free_pcppages_bulk(zone, batch, pcp); - pcp->count -= batch; + free_pcppages_bulk(zone, pcp->batch, pcp); + pcp->count -= pcp->batch; } out: -- 1.8.5.2