Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp217073imu; Thu, 8 Nov 2018 00:24:19 -0800 (PST) X-Google-Smtp-Source: AJdET5f7WQ1cTgn94SwKUBzpUUC4u9C1ffiMT7m2m5RBS2R9P2nIsomAKKMIhaYaItE7G4wlGSwu X-Received: by 2002:a63:ac02:: with SMTP id v2-v6mr3050445pge.414.1541665459403; Thu, 08 Nov 2018 00:24:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541665459; cv=none; d=google.com; s=arc-20160816; b=V3lHlLdpWEpfGovNoxtHSx80egYD46937zqYn6c8lZZbLVTc7lUZiPBWETdQXFH/1X X99QYg2sDQ1NeBiAu1kRRNa+L78YkK4EP0tpu64Lpx8EDkRHon7x87Zn0XsL1blPF7mL YTUw6zvYUUyZXyNQsV7bPQY6o+y2xJ5xDAaNxYx9ssueLtXn4o2n0U97Glp9TC8XUDAl RCQC/MyWu8+mBuEhUClq0unEwsDNDdOilFOUXSGndaRNnPq/BAp+IKHkBSJHIEJNrXWR Gq8Lmty+9maJTSeWurC/9Rb+Z+Sx3JI100ZJXvI7r3hroOeowttVY6rut8IRx9PYxBGO QkwQ== 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=ButyDGhDCk2HuCgaJ33BiVu/ttZAdRpYbo3H/CAHuSI=; b=DOdlBtE0bG58xg3KZjHLZjycx2Z4278esFAOZYB2NwmLgy278ur2WreECq3d3KcgpM XhnHcy5Zwnroekqp1h4POBWxq5vJgfUW3kIr5dvzwzUPhzOCn27rx1rbceOzQUjiEbty 4J2KwRwmLZuAT4c+S0fW1H/ZduKwPyeIFYt9HvGyRrVR/udEkKIqu70zq4KaNxoc5L2O fncl+Yf5PamDlxkTihzg9kibfj9kQzRW03kemrkmO1viKZLymL5DIQCLgfdKL8Uh/WpV /QueW+udcL+/emR4g+C0GcVReJHBk3QwQ2kj5unLzqNOv4ji3yejyhSvbznzFVrTXlwo tDlQ== 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 be7-v6si953814plb.267.2018.11.08.00.24.04; Thu, 08 Nov 2018 00:24:19 -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 S1726876AbeKHR6D (ORCPT + 99 others); Thu, 8 Nov 2018 12:58:03 -0500 Received: from alexa-out-blr-02.qualcomm.com ([103.229.18.198]:32583 "EHLO alexa-out-blr.qualcomm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726162AbeKHR6D (ORCPT ); Thu, 8 Nov 2018 12:58:03 -0500 X-IronPort-AV: E=Sophos;i="5.54,478,1534789800"; d="scan'208";a="233248" Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by alexa-out-blr.qualcomm.com with ESMTP/TLS/AES256-SHA; 08 Nov 2018 13:53:26 +0530 X-IronPort-AV: E=McAfee;i="5900,7806,9070"; a="5699124" Received: from blr-ubuntu-104.ap.qualcomm.com (HELO blr-ubuntu-104.qualcomm.com) ([10.79.40.64]) by ironmsg01-blr.qualcomm.com with ESMTP; 08 Nov 2018 13:53:25 +0530 Received: by blr-ubuntu-104.qualcomm.com (Postfix, from userid 346745) id 6FA5923A8; Thu, 8 Nov 2018 13:53:25 +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 v3 4/4] mm: Remove managed_page_count spinlock Date: Thu, 8 Nov 2018 13:53:18 +0530 Message-Id: <1541665398-29925-5-git-send-email-arunks@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1541665398-29925-1-git-send-email-arunks@codeaurora.org> References: <1541665398-29925-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 Acked-by: Vlastimil Babka --- 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 f8b64cc..26c5e14 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; EXPORT_SYMBOL(_totalram_pages); unsigned long totalreserve_pages __read_mostly; @@ -7065,14 +7062,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