From patchwork Tue Nov 6 16:21:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun KS X-Patchwork-Id: 10670781 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 039EB13A4 for ; Tue, 6 Nov 2018 16:22:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E83F32A796 for ; Tue, 6 Nov 2018 16:22:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC3E42A7AA; Tue, 6 Nov 2018 16:22:53 +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 6FF992A7A8 for ; Tue, 6 Nov 2018 16:22:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 587E46B0340; Tue, 6 Nov 2018 11:22:52 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5384F6B0341; Tue, 6 Nov 2018 11:22:52 -0500 (EST) 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 44FCA6B0342; Tue, 6 Nov 2018 11:22:52 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id 0571E6B0340 for ; Tue, 6 Nov 2018 11:22:52 -0500 (EST) Received: by mail-pf1-f197.google.com with SMTP id x62-v6so9079144pfk.16 for ; Tue, 06 Nov 2018 08:22:51 -0800 (PST) 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=LnZ8TuL4xJvwlu0PvcNJOpfZSCm+CkzqQVmijb1p40Q=; b=jK52eZAK9aLgkD/2P8Mm0jBlQ7wTiZP7GqtOSN+K98BIdiIxdMfNJs4qRVTpXlMO+5 wQhNJfnayMTEZu21K2lj2ERtcpOEMos1sIrz2yDcl4iCuyJfAS+QiXsMSKcbz/hW5fBP 6bqOhVURuNgw6j/1W1mf+L1wBpZdU4EABKcF3W/JL4pYC6Ls6GHs9cViOHQy/SWONV+P JQWFgp6FjpzFqgI5gPTLEYisJfAJKs2uh5OWciyiaks+L8k1vCMntcOYuvqutMZ/B6T9 8cTyyAfemL9yjB9+PAPpi21Qr8j7wNYTrVAD1GqEUYexIRtbpfor0fHiAUjX6S32fPO9 EDGA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of arunks@qualcomm.com designates 103.229.18.198 as permitted sender) smtp.mailfrom=arunks@qualcomm.com X-Gm-Message-State: AGRZ1gK8vaHmDqcYkPPX7fz0zCYKh35Kei3j+/WnpeK9Ap01CFUycXpi K0aqF+PeEW6/5di2eGExGHiFzGBifo1pHtM+/0GDalfhDmhrlarKwv+VII8jh0Qq3Aig5ZlINVw C4NdOM8p+SBvHHrER9NyFf44u3MCwAcEWVOHCiOiUruXheTTxx0i0Yjjuyo3VePY= X-Received: by 2002:a17:902:e10f:: with SMTP id cc15-v6mr8080590plb.309.1541521371675; Tue, 06 Nov 2018 08:22:51 -0800 (PST) X-Google-Smtp-Source: AJdET5dUs6z0ojmZBrNnC9SSa9Q+z2/gbGPrm+LcBowUhaTuOpn3vafx0c68loEeqszJhBEwKiLR X-Received: by 2002:a17:902:e10f:: with SMTP id cc15-v6mr8080543plb.309.1541521370870; Tue, 06 Nov 2018 08:22:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541521370; cv=none; d=google.com; s=arc-20160816; b=tNjCqpU1EdEAsSfj7v4n3tUSkHpX0bDU2q0C05jNBplyfWaM/57yWSEFpoqlGzcIV2 V0LpE/CVcff0zHFMy4Euns+hfkR6rh7l98zYVNCQ7ky/s7wSj8QGUtcSz0KTRZ8qkeUD HTCfc6kA7qlJ416Rmqd3MXZgIQVGd7WYRvAws9W9YcWGw8NqaLXr7nrFlAB5vr99nAyQ Q01D3fIQXZKrOVc2diTAymiYBZzHv4G7IEgHqZBuLGJ0eDq9OmLEIZ7QWAEgw6kUyWUv SOAVNnOSx64RtgKU8b43YTWPGn8jQp+bAMpdMjIkpp8VFvi+fALVvk6bIlJ1cF5W116U TXtg== 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=LnZ8TuL4xJvwlu0PvcNJOpfZSCm+CkzqQVmijb1p40Q=; b=fWYYZGW1jacLmxe7gCxlb5AiH7F0V85JdHj+tabgR4nTMr7wIaF91T8qXPYjrh+I/j tgFiwoeUt048eKh6hU2pHnc4P5PYi/kdSa0x6Z2VR8fVUjx9BzYQwJTlW+IfbcdeFvh2 ZQtAtTV+Khr4986SqWcBFqOWVeo0lyNFk6QBK+JbzT0Fgy6xCKXaa6GVhw+Dni7UKql2 ty0fYxZSrI8/sojupRfViAEGDJnu2fIkkRVFHpDJNmvJGGAS6MBpT2CNiuolIpqtxv+F t43y/LvYArgrWzfwYgGzM3iio6ng5I2efV6CHyoQCT/ubLk3FtzpKw8uPj9IrniIYZNo 4R6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of arunks@qualcomm.com designates 103.229.18.198 as permitted sender) smtp.mailfrom=arunks@qualcomm.com Received: from alexa-out-blr.qualcomm.com (alexa-out-blr-02.qualcomm.com. [103.229.18.198]) by mx.google.com with ESMTPS id g13-v6si13847326plo.68.2018.11.06.08.22.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 08:22:50 -0800 (PST) Received-SPF: pass (google.com: domain of arunks@qualcomm.com designates 103.229.18.198 as permitted sender) client-ip=103.229.18.198; Authentication-Results: mx.google.com; spf=pass (google.com: domain of arunks@qualcomm.com designates 103.229.18.198 as permitted sender) smtp.mailfrom=arunks@qualcomm.com X-IronPort-AV: E=Sophos;i="5.54,472,1534789800"; d="scan'208";a="231811" Received: from ironmsg03-blr.qualcomm.com ([10.86.208.132]) by alexa-out-blr.qualcomm.com with ESMTP/TLS/AES256-SHA; 06 Nov 2018 21:52:17 +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> 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 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);