From patchwork Fri Oct 26 11:01:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun KS X-Patchwork-Id: 10657225 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3883013A9 for ; Fri, 26 Oct 2018 11:01:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 284642C3DC for ; Fri, 26 Oct 2018 11:01:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C32B2C3EA; Fri, 26 Oct 2018 11:01:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA2DC2C3DC for ; Fri, 26 Oct 2018 11:01:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 657EE6B02FE; Fri, 26 Oct 2018 07:01:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5B8BE6B0300; Fri, 26 Oct 2018 07:01:32 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40AD26B0301; Fri, 26 Oct 2018 07:01:32 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id F27CF6B02FE for ; Fri, 26 Oct 2018 07:01:31 -0400 (EDT) Received: by mail-pg1-f197.google.com with SMTP id h9-v6so369938pgs.11 for ; Fri, 26 Oct 2018 04:01:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=zc3ufWwnDXl1knnN26nsL6UFGzDw/bEbF/g5FgRRvhY=; b=cETssV/+l3EvlgeOLBiBYXwSJju+EecOmh97u8zqYueR1eOX9buNzROFFfCMKOGmUp aujWEkSsSg6XDz9KwimVY5U4ldrh9l1l76Xnom8hexff2KSHVEOWNoANL2+l/dg/4kNo okF7WVxeo00x4OoVnD2YivgAQF4Q7Fpae9rnN///ej0ITfhWWaqFmT6ox4ntg8gKNDE5 vRaBdUuxGhZcH7X+QvOzYe+JdJ61s41be6tUYbTXrtWse0fNjSxLEiOxOi16W+yLdbtQ VtUlf5WMxTMuygzGzk8QXhlPXoLkQ/z7Zo8RhWfAyXxvcp8jeMpF43ALXPGl1NNe4+Dx y29g== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of arunks@qualcomm.com designates 103.229.18.197 as permitted sender) smtp.mailfrom=arunks@qualcomm.com X-Gm-Message-State: AGRZ1gKry+hCHPZUhMFHE9SHfhGsgaCmua7mOpqlL7HSJTKeVeBcJz5V hgwhpZuXm6bknNr01bU7hicsbON7y43j0iYlAX5mMOBHI1Tvz1ip1GZYDv99jnNWR+UEUYQOcXP sV40WkUZ/gYhMKchHMDUIBYIgkAMWT3u6s0+ItGSjjLs2oZfbwgWTgEg390QVYtU= X-Received: by 2002:a63:7418:: with SMTP id p24mr3073424pgc.196.1540551691686; Fri, 26 Oct 2018 04:01:31 -0700 (PDT) X-Google-Smtp-Source: AJdET5ecrh8rxEaErHIw4PAWhJuOzUnc4H9Pkj+tc5Ufz2ogBOyPrDvxVXPneKvptb/mwUNFRfWX X-Received: by 2002:a63:7418:: with SMTP id p24mr3073382pgc.196.1540551691108; Fri, 26 Oct 2018 04:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540551691; cv=none; d=google.com; s=arc-20160816; b=HVV1eouh+UQuwhjwFKRFpO1AFScTuNXBv5oZMvk4jdLj+hLT3cI9ZWcgiRoQhYetR8 gz+EYtOu5eY6cfXDCXkOA6PealdjXZtFvguvrd26x66a5tEqT+12w4FzDJWH8pLqUQKS 4JcP7ET+0YrJVEhO5BwSKnNMAZDkrBfehof1FDe+BPvI1eiBIJVTabj7GUIzoebWXSr0 RbygUKAXQwX3b93xTClCFIy7EP9P0eCfOCzrjsDamUwl2Y53/VBPn251lBVQo7AO6OKr ctsFJLa5ZcMpvJF2+uiTsBahmzytjHZynd7VpBA82aF+xPpHOpusq3uF6p8CjTWudSSp kJog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=zc3ufWwnDXl1knnN26nsL6UFGzDw/bEbF/g5FgRRvhY=; b=OC5Aaa5S2kCBMkOWqiaNzSRvHy/IQZREqe+JHDacaXrPhVdeyi19kW+CTAvZWqsaxW HtPUIVXDEko0ETs0UIhnyH/BHRtTmeU1IBnjRRBZqQzi8/9sGvdZ6sska+WkQi59Cxk6 0I/CUusQfm6tt1C25UPXwJ8bfdpQJBtDt0Orc1GoGdIvvI3NV+xT+hUh8ycAPwMpPHVF B+2KKcsB9gnVPZgi8MjDaNjavvNJFHm9JaZzgxF1XpuzSW6cOdcnvZO/1tseynh/1uqe AztKXrIIk6SmvLWEhCJ/p/O4WxMZxdsTcZwWnsrzQoSG4hEk4N/aPYOFxqpe4HZzQmRe CGYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of arunks@qualcomm.com designates 103.229.18.197 as permitted sender) smtp.mailfrom=arunks@qualcomm.com Received: from alexa-out-blr-01.qualcomm.com (alexa-out-blr-01.qualcomm.com. [103.229.18.197]) by mx.google.com with ESMTPS id g9-v6si7269096pgp.488.2018.10.26.04.01.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 04:01:31 -0700 (PDT) Received-SPF: pass (google.com: domain of arunks@qualcomm.com designates 103.229.18.197 as permitted sender) client-ip=103.229.18.197; Authentication-Results: mx.google.com; spf=pass (google.com: domain of arunks@qualcomm.com designates 103.229.18.197 as permitted sender) smtp.mailfrom=arunks@qualcomm.com X-IronPort-AV: E=Sophos;i="5.54,427,1534789800"; d="scan'208";a="262442" Received: from ironmsg03-blr.qualcomm.com ([10.86.208.132]) by alexa-out-blr-01.qualcomm.com with ESMTP/TLS/AES256-SHA; 26 Oct 2018 16:31:30 +0530 X-IronPort-AV: E=McAfee;i="5900,7806,9057"; a="1798199" 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:31:30 +0530 Received: by blr-ubuntu-104.qualcomm.com (Postfix, from userid 346745) id 1BC5E2F15; Fri, 26 Oct 2018 16:31:29 +0530 (IST) From: Arun KS To: Cc: keescook@chromium.org, khlebnikov@yandex-team.ru, 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:31:02 +0530 Message-Id: <1540551662-26458-5-git-send-email-arunks@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1540551662-26458-1-git-send-email-arunks@codeaurora.org> References: <1540551662-26458-1-git-send-email-arunks@codeaurora.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Now totalram_pages and managed_pages are atomic varibles. No need of managed_page_count spinlock. Signed-off-by: Arun KS 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 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);