Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2060818imu; Tue, 6 Nov 2018 08:29:28 -0800 (PST) X-Google-Smtp-Source: AJdET5ftGu8Z/o/rRQVqjsatxmCyywO1WSPzXqplMxu37sUNWc1zzDMBFS6TLerwqtIJgmuJsflB X-Received: by 2002:a62:418a:: with SMTP id g10-v6mr26682141pfd.44.1541521767952; Tue, 06 Nov 2018 08:29:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541521767; cv=none; d=google.com; s=arc-20160816; b=Le0Ip4G0nTuqzpdkLhgOtZKg1F//f+GPY0it9HQoI+isb+PW6v+th/eLVl8+IVO/J9 rv7ufsicW1fJGSz9kwdVUyon5Bs3dRcBPVfmho6wN49QeBbLKV3qzB8oQEcuUi3bh6LY 7TF3uzwyovlIgkDSr9PCO2WbefXd45000M4l0lx9ULDkV3gzkrUEaFEgA1xTDe2pcjo8 HSes85dWGevfBe3k5QrjheyuEm4EleIxVGNnKMvF/5DLHKVsBsJ9o5xRMlXUPLbqBnso JHi3uK+Ytlqhu+jY/jDye/iDAnnxX+S6zeiHqafDqV76hLGQF8a8PI61o6ueiJhnX2n4 LFQA== 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; bh=LnZ8TuL4xJvwlu0PvcNJOpfZSCm+CkzqQVmijb1p40Q=; b=ypJ87m++Z1PPt2ezdXFmRjCcrUaJYlcg2S+vOWec7yVZdcNqmQW02BEGiEFHzxg1Mn Ygvi0ZoQs0nxCGyXFO2j1DtBgUWA4xCRnLlxibuvO3lp7ChrxwalMbPXp8oqtZ9sRZTb c0DSHIA4fZCjPZ4kzgJSHE7Pbc+VdQa+U84HexkYugP267yLnwawypeO9bmPZwDz58YD Ak06elTkGmUrIjKCOSTJu56o50CpOqzl71VeouZ2slCnm2748Vpp0X0gMUXguO7gsh+M b6FJLDj+t0A58rMh6KzvLfgSaiFBw+L1eaLTsc6ZyZYsva4yKQtOr6AjnASzj7t9Q4OQ elhg== 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 d12-v6si22609463pla.24.2018.11.06.08.29.12; Tue, 06 Nov 2018 08:29:27 -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 S2389415AbeKGByc (ORCPT + 99 others); Tue, 6 Nov 2018 20:54:32 -0500 Received: from alexa-out-blr-01.qualcomm.com ([103.229.18.197]:22830 "EHLO alexa-out-blr-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389375AbeKGBya (ORCPT ); Tue, 6 Nov 2018 20:54:30 -0500 X-Greylist: delayed 374 seconds by postgrey-1.27 at vger.kernel.org; Tue, 06 Nov 2018 20:54:22 EST X-IronPort-AV: E=Sophos;i="5.54,472,1534789800"; d="scan'208";a="277259" Received: from ironmsg03-blr.qualcomm.com ([10.86.208.132]) by alexa-out-blr-01.qualcomm.com with ESMTP/TLS/AES256-SHA; 06 Nov 2018 21:52:16 +0530 X-IronPort-AV: E=McAfee;i="5900,7806,9069"; a="1957400" Received: from blr-ubuntu-104.ap.qualcomm.com (HELO blr-ubuntu-104.qualcomm.com) ([10.79.40.64]) by ironmsg03-blr.qualcomm.com with ESMTP; 06 Nov 2018 21:52:17 +0530 Received: by blr-ubuntu-104.qualcomm.com (Postfix, from userid 346745) id C859531D5; Tue, 6 Nov 2018 21:52:15 +0530 (IST) From: Arun KS To: akpm@linux-foundation.org, keescook@chromium.org, khlebnikov@yandex-team.ru, minchan@kernel.org, mhocko@kernel.org, vbabka@suse.cz, osalvador@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: getarunks@gmail.com, Arun KS Subject: [PATCH v2 4/4] mm: Remove managed_page_count spinlock Date: Tue, 6 Nov 2018 21:51:50 +0530 Message-Id: <1541521310-28739-5-git-send-email-arunks@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1541521310-28739-1-git-send-email-arunks@codeaurora.org> References: <1541521310-28739-1-git-send-email-arunks@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now totalram_pages and managed_pages are atomic varibles. No need of managed_page_count spinlock. Signed-off-by: Arun KS Reviewed-by: Konstantin Khlebnikov Acked-by: Michal Hocko --- include/linux/mmzone.h | 6 ------ mm/page_alloc.c | 5 ----- 2 files changed, 11 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index e73dc31..c71b4d9 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -428,12 +428,6 @@ struct zone { * Write access to present_pages at runtime should be protected by * mem_hotplug_begin/end(). Any reader who can't tolerant drift of * present_pages should get_online_mems() to get a stable value. - * - * Read access to managed_pages should be safe because it's unsigned - * long. Write access to zone->managed_pages and totalram_pages are - * protected by managed_page_count_lock at runtime. Idealy only - * adjust_managed_page_count() should be used instead of directly - * touching zone->managed_pages and totalram_pages. */ atomic_long_t managed_pages; unsigned long spanned_pages; diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2a42c3f..4d78bde 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -122,9 +122,6 @@ }; EXPORT_SYMBOL(node_states); -/* Protect totalram_pages and zone->managed_pages */ -static DEFINE_SPINLOCK(managed_page_count_lock); - atomic_long_t _totalram_pages __read_mostly; unsigned long totalreserve_pages __read_mostly; unsigned long totalcma_pages __read_mostly; @@ -7064,14 +7061,12 @@ static int __init cmdline_parse_movablecore(char *p) void adjust_managed_page_count(struct page *page, long count) { - spin_lock(&managed_page_count_lock); atomic_long_add(count, &page_zone(page)->managed_pages); totalram_pages_add(count); #ifdef CONFIG_HIGHMEM if (PageHighMem(page)) totalhigh_pages_add(count); #endif - spin_unlock(&managed_page_count_lock); } EXPORT_SYMBOL(adjust_managed_page_count); -- 1.9.1