Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp618898ima; Fri, 26 Oct 2018 04:02:46 -0700 (PDT) X-Google-Smtp-Source: AJdET5fsgLb5++LEB0PogRYIpwTCFGBsEGfLo7YRLkOEIPxLI0oyTcrWtdvT7oEvPyuj+bYv27uS X-Received: by 2002:a63:124b:: with SMTP id 11-v6mr2983460pgs.299.1540551766236; Fri, 26 Oct 2018 04:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540551766; cv=none; d=google.com; s=arc-20160816; b=xcjGth/eveSrBIGuznO+ph98V8w7vYLss53Y6cE3STb7z7ajehL8l5yox7Zi/3Vx6b NyWD8zJmEwajc/WcjdjjUDyjluSprGRRmd/iZfWbwb7q8b2k6AzQM9n+GMHgKAlkh7U8 7PdIKP6KfSucBXCP4P7nScQ2+a5nbjHI9jfcaRLigtISsBWXALP6RR5lSjF0co13dY99 XP/BKpus8pO58stTZIZoNzIfpN1h7Nx9htjHRQdwIaX0dvtV9eXLNSIEct8Z8cfDe7fT ctb89XFwzUC4zU0xuEzFdKC8cblxKdhuJm6TgR4KpeETFgBtxg6rTa0/v1MuR0I+x2H2 4Qdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from; bh=zc3ufWwnDXl1knnN26nsL6UFGzDw/bEbF/g5FgRRvhY=; b=tunPW4YzO8dIQvUVvkl/89NMjVO5Pg9J4ke/JZbRbo5iE5984RWNA/7Jj9ry05j5VA N2eYPQm6UPQ4d8OdE2aAFhujlkVSlbEN/kEc1YUac8ghXNf7pni35/ZBao+BCqNkGIx+ /+eJEOk4ExiFFX5pPJKUL8txsmu4upX4PmloNZ6Auvq0Z0F8i56oiq/RT1vGAHC9w55q Iy0OnekRYUGWRhYAHURTnXNyFtPYbQLd2L1X2IYXPk3tKWcFlYJoShPlQR1a2ZleXjVA ISs6rW8rTIoTtMFDfrPopJeh+ri7H6ta/sQfcpKkyPt6rofNCBZ6tlTZvDP2+vFokUhd wgUA== 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 11-v6si1387710pfz.210.2018.10.26.04.02.30; Fri, 26 Oct 2018 04:02:46 -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 S1727641AbeJZTh0 (ORCPT + 99 others); Fri, 26 Oct 2018 15:37:26 -0400 Received: from alexa-out-blr-02.qualcomm.com ([103.229.18.198]:40094 "EHLO alexa-out-blr.qualcomm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727525AbeJZThT (ORCPT ); Fri, 26 Oct 2018 15:37:19 -0400 X-IronPort-AV: E=Sophos;i="5.54,427,1534789800"; d="scan'208";a="219911" Received: from ironmsg03-blr.qualcomm.com ([10.86.208.132]) by alexa-out-blr.qualcomm.com with ESMTP/TLS/AES256-SHA; 26 Oct 2018 16:30:37 +0530 X-IronPort-AV: E=McAfee;i="5900,7806,9057"; a="1798190" 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; 26 Oct 2018 16:30:36 +0530 Received: by blr-ubuntu-104.qualcomm.com (Postfix, from userid 346745) id E4E0B2F13; Fri, 26 Oct 2018 16:30:35 +0530 (IST) From: Arun KS Cc: keescook@chromium.org, minchan@kernel.org, getarunks@gmail.com, gregkh@linuxfoundation.org, akpm@linux-foundation.org, mhocko@kernel.org, vbabka@suse.cz, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Arun KS Subject: [PATCH v1 4/4] mm: Remove managed_page_count spinlock Date: Fri, 26 Oct 2018 16:30:31 +0530 Message-Id: <1540551631-24208-5-git-send-email-arunks@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1540551631-24208-1-git-send-email-arunks@codeaurora.org> References: <1540551631-24208-1-git-send-email-arunks@codeaurora.org> To: unlisted-recipients:; (no To-header on input) 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 --- 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 597b0c7..aa960f6 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 af832de..e29e78f 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; @@ -7062,14 +7059,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