Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4934758imm; Tue, 7 Aug 2018 09:42:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfXdcFaU23sMHB3k4cr692km/KPbVfiNfxX4eMLB+XRrHbQgR/FFSUadr9dQtecawC3HsRx X-Received: by 2002:a17:902:ba88:: with SMTP id k8-v6mr18577455pls.259.1533660176258; Tue, 07 Aug 2018 09:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533660176; cv=none; d=google.com; s=arc-20160816; b=nBSeSYXlIE2JXspGZyorsNIl0ZRan9mQKSZyYvKDEgOHjUPAMzkuj2n8TAJmSWD/dY Oc3B6GdCwHgJu9AkQBJo1FqKawnEWp24BZxnZuPSfAjhoEn8QYFDPWBqDA3FU/YhQMKu J819cKbV0Xu1SflJ4ac5iacdjDP8h7HRDklMISQcOItpvIAf6/87MtLWik8SdnR07ode 3gewuziSLX6szwzzoeEAhVxX+nlCEWixhKEvc6rTZJ4K0dOCTUgD5jrpacIjZ0kwOKpC OFNrQNGRRkDp9dy5JXLBPW5LnPAcgDee3bH+jSIBDceXPtZ+MVg/wO+E0sXGfN4VIIhD Is6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject :dkim-signature:arc-authentication-results; bh=E7jHJUl1lc3BUVao1mtGPcK2ZJN1Fh8IXYergT6SrkQ=; b=MeUh4EpEo4amOKNccejOAIr8D9CYqbRv0FmXDOf7UnPwbHiyQ4A9NUlwmKaxtEk/0v 6ltC67lq9IdDzAA+ExetMDQEtbB5HLugp13HnW9068hknPTvEQygID3Sq8BcVx1cqz37 5w7XRb0ApuX2fn7seLofogJjPpulVw/+L0t+W3fUpATQJZtui9ehyv6r//24DCozK/2Y EmGb8ugUHx11tX/9aWTPyfPqfvUkJMFacxA8uT8E37NbEFidYO3zaeB0PKrz56VqCQB+ DrVffCbq36pRBnu3ZVW+QFOFcMEL74GIC8dFyoUOjBCoUlo9Sv9UnRgBXHL/Lp5qYT7r IfzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b="Z9jr/qGX"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15-v6si1342855pli.194.2018.08.07.09.42.38; Tue, 07 Aug 2018 09:42:56 -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; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b="Z9jr/qGX"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390037AbeHGRxM (ORCPT + 99 others); Tue, 7 Aug 2018 13:53:12 -0400 Received: from mail-eopbgr40092.outbound.protection.outlook.com ([40.107.4.92]:32448 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388677AbeHGRxM (ORCPT ); Tue, 7 Aug 2018 13:53:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E7jHJUl1lc3BUVao1mtGPcK2ZJN1Fh8IXYergT6SrkQ=; b=Z9jr/qGXKvbVQDICc/oUuACt/klkRQy9bZImGLH+C/8BGn1dOW3heNsWVf+TBBg2aYmLeKc0pAWNJbvLXE7B9DbzlNDE3qUu0z5O2JjBmdBFzmHO32n+eexG7MhZWakFzKAMdagmZeqItmtBpp6PoQnelA70N3+uhjn4RRzXusw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by VI1PR0801MB2031.eurprd08.prod.outlook.com (2603:10a6:800:8b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 15:38:03 +0000 Subject: [PATCH RFC 03/10] mm: Convert shrinker_rwsem to mutex From: Kirill Tkhai To: akpm@linux-foundation.org, gregkh@linuxfoundation.org, rafael@kernel.org, viro@zeniv.linux.org.uk, darrick.wong@oracle.com, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, hughd@google.com, shuah@kernel.org, robh@kernel.org, ulf.hansson@linaro.org, aspriel@gmail.com, vivek.gautam@codeaurora.org, robin.murphy@arm.com, joe@perches.com, heikki.krogerus@linux.intel.com, ktkhai@virtuozzo.com, sfr@canb.auug.org.au, vdavydov.dev@gmail.com, mhocko@suse.com, chris@chris-wilson.co.uk, penguin-kernel@I-love.SAKURA.ne.jp, aryabinin@virtuozzo.com, willy@infradead.org, ying.huang@intel.com, shakeelb@google.com, jbacik@fb.com, mingo@kernel.org, mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Date: Tue, 07 Aug 2018 18:38:00 +0300 Message-ID: <153365628066.19074.11561153370778563231.stgit@localhost.localdomain> In-Reply-To: <153365347929.19074.12509495712735843805.stgit@localhost.localdomain> References: <153365347929.19074.12509495712735843805.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To VI1PR0801MB2031.eurprd08.prod.outlook.com (2603:10a6:800:8b::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f5a6071-f4d4-4df1-2e42-08d5fc7bc599 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB2031; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2031;3:wC1Ak5LGoD5+LOhgASazwwFvf4+Winewb//x1LEdGx/zYiz6nvqQPCRC0drX16/LGeIU5hYp+igZCc3I7vuvzy2bVP/8Nb3VklJlF+KiM2wivPCM3cqM95+OvG4M9rIiA8asIwEyEqYfLWhpQf3CWgiuxBbo22yLaz0YV6ubzRf0jWJcTOQE/yTktzOf67lWjsypeyUyAbYXo7BiZM3lLPyXIiXPVXoTYK6oMwFPbDTAIk5255eA90IorkXwLaOy;25:QaAVIUD58rzXlmjEfmkP3kycIrpAwlapDyiSsYrDv1MHobrI+RpGlTH7FrqdUN9uZcKbDQx+ryl0krnkFIxC+FZc3xxOExxRTDqf8mhPYKyMbLgXJU/wYVi3ZICUWi57pE4BoIBBzw+u+WEo+6wtS/MCCFlofbZ5I3OuMKbhf3EBEq3pDcOCG7/yR+c16EyDnLIV3L191ViDi0BIWnth4z7hNlGewS/fp5ZEDrByFSnADxULG3KSZUiNlXLE18ZRrbv6VPfvvUzdiI3+Yq0QviSDOzCvFTB93B9xg+ZsxM7svF9YRmN4kN6MYTiJIXobCtuPvMoVyShzUwm/QA9lQA==;31:uA1slugcr8YqTDXexE2Ljb7D/6G8y9Emv8cxPFzOSx+pQKSbHoMUkiMO3CTmx1aRylo6SZm4/2VFCYdC8q1ISWi0eRGp0TPI5APNSSpzGE562nIjYIhydRf3q/IyL/AzhVX+qdpRLlNIvGfEeLbEEax2NrYOXsGNflkZbYkuF4AAsnJCIgPkbFRDBh8RA1fWuNHeEYh7jKV+dkO9MCMjnxbcI1lpqDcTWdcCtZWLKTg= X-MS-TrafficTypeDiagnostic: VI1PR0801MB2031: X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2031;20:i3PT1myEcXjNUnGNEX4e2EHbHKdbJt2F3ILSjK2RHw6ur1SjDrjIPiYiK3jyE1culVapkXxENf8iKePNteKzpLyhUTjOkJdzH7vs7W9ail+g3eEtYktCmcvHgnjtcpBGEKa5Ha1dpVjZ4swL6ijhHax49mscK3c5EjLNpyt791VurCxpxX3wuE2hh7ODRobxtb/p9hLUKK+lPHbHFoj41tafCeSSG4HnABm0kGaEUHewktUf7WbHQ+k5WXrzgcA7UlJoucpVittmR7HmywO8rZUmDtOajlZVV3KChBtyqFkaHBsVwU1TNjzCkik/JhIaqtuY2WAXbMiwASn3+o1VZFqM8KRY5JQfeTG2Gb4QJIt61HXIt9IQjj78eXyc1HAIahntfUk+YLDS467LUQezltUw4XEC8kzeP2tRE08WQsxRBNPHCiQaFbQttT0qcG9fhHhKdbzagu3hHhvyLkNFgTixAYLwdRl58jMzLsw4uk5Fd6hyko522X+BV5cDZxjd;4:gT20+UFzBxMZ2jmy15wsyR2TOPPztonLA0kFdcnTzT8opka9J4xpoK+yc7hmjB4Xk76etdzRSMvyfUU1goF5uBj67e3YLMC21a7srorrR1p++wrqewig8pUefp1HLcRRIygnPYpctLAG041JdWECA/1sl4Y7ALdm6FL4yGoaCkeVn14lDuWhWZWXh+fsf6UbDUyjeJVO2/xSESRHfU6wkxPmirzNGGGA/mEb/l1xmqV7HAIzLyhrCcpLXc12uJFYfgCwrYrxXeTDLqAZyYvT1Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:VI1PR0801MB2031;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2031; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(39850400004)(396003)(346002)(136003)(366004)(376002)(189003)(199004)(66066001)(14444005)(5660300001)(7416002)(8676002)(186003)(7406005)(16526019)(446003)(55016002)(26005)(81166006)(81156014)(8936002)(305945005)(39060400002)(86362001)(68736007)(9686003)(7736002)(53936002)(217873002)(25786009)(230700001)(476003)(316002)(956004)(486006)(76176011)(61506002)(6116002)(3846002)(97736004)(33896004)(478600001)(2906002)(6506007)(106356001)(50466002)(11346002)(23676004)(47776003)(103116003)(58126008)(2486003)(7696005)(52116002)(386003)(105586002)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2031;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA4MDFNQjIwMzE7MjM6aGw2djF1T2NNeGJsRXExbXBOKzNUUFll?= =?utf-8?B?TVVjdTdGODRvRkxiT3FUWnQ1UWRmT3h2RldxZHVGNFZPTlgvcktDVWNrYVhj?= =?utf-8?B?LzhSbDViV01TbWlyU0x5VXNyblIza2dtMkFXc29lYlN0ZlNiTC8yMXRXWG9w?= =?utf-8?B?TGVnUWQxU0lFUXIwVWRXQmh5Z05aMUhNWm8yclZXeEZjUUs1bEdCQi9ySmp4?= =?utf-8?B?MjhJWFAwaE02MlN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M X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2031;20:34l/63cvVAts2itXDdUTOURI6qSLU8yAuguthW1mWhr+Z7wD1mAcBHfqcjgXgGEOxdyfO/rCSe38a3h+N5FjW5GxyBA73jUd2GodQYgQ1AcMbiJyf64X3WDvyT0NFzUdPgKCYGb8DnADNkLBO0ufZWkbKVVN2cA5VF7dICWDWXw= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:38:03.6852 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f5a6071-f4d4-4df1-2e42-08d5fc7bc599 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2031 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are no readers, so rwsem is not need anymore. Signed-off-by: Kirill Tkhai --- mm/vmscan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 9dda903a1406..2dc274a385b9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -167,7 +167,7 @@ int vm_swappiness = 60; unsigned long vm_total_pages; static LIST_HEAD(shrinker_list); -static DECLARE_RWSEM(shrinker_rwsem); +static DEFINE_MUTEX(shrinker_mutex); DEFINE_STATIC_SRCU(srcu); #ifdef CONFIG_MEMCG_KMEM @@ -192,7 +192,7 @@ static int prealloc_memcg_shrinker(struct shrinker *shrinker) { int id, ret = -ENOMEM; - down_write(&shrinker_rwsem); + mutex_lock(&shrinker_mutex); id = idr_alloc(&shrinker_idr, SHRINKER_REGISTERING, 0, 0, GFP_KERNEL); if (id < 0) goto unlock; @@ -208,7 +208,7 @@ static int prealloc_memcg_shrinker(struct shrinker *shrinker) shrinker->id = id; ret = 0; unlock: - up_write(&shrinker_rwsem); + mutex_unlock(&shrinker_mutex); return ret; } @@ -218,9 +218,9 @@ static void unregister_memcg_shrinker(struct shrinker *shrinker) BUG_ON(id < 0); - down_write(&shrinker_rwsem); + mutex_lock(&shrinker_mutex); idr_remove(&shrinker_idr, id); - up_write(&shrinker_rwsem); + mutex_unlock(&shrinker_mutex); } #else /* CONFIG_MEMCG_KMEM */ static int prealloc_memcg_shrinker(struct shrinker *shrinker) @@ -405,10 +405,10 @@ void free_prealloced_shrinker(struct shrinker *shrinker) void register_shrinker_prepared(struct shrinker *shrinker) { - down_write(&shrinker_rwsem); + mutex_lock(&shrinker_mutex); list_add_tail_rcu(&shrinker->list, &shrinker_list); idr_replace(&shrinker_idr, shrinker, shrinker->id); - up_write(&shrinker_rwsem); + mutex_unlock(&shrinker_mutex); } int register_shrinker(struct shrinker *shrinker) @@ -431,9 +431,9 @@ void unregister_shrinker(struct shrinker *shrinker) return; if (shrinker->flags & SHRINKER_MEMCG_AWARE) unregister_memcg_shrinker(shrinker); - down_write(&shrinker_rwsem); + mutex_lock(&shrinker_mutex); list_del_rcu(&shrinker->list); - up_write(&shrinker_rwsem); + mutex_unlock(&shrinker_mutex); synchronize_srcu(&srcu);