From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FF11D0E3F7 for ; Thu, 24 Oct 2024 19:38:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8ECA06B0083; Thu, 24 Oct 2024 15:38:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 89CAA6B0088; Thu, 24 Oct 2024 15:38:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7646A6B008A; Thu, 24 Oct 2024 15:38:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 57D266B0083 for ; Thu, 24 Oct 2024 15:38:31 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 593361C72A2 for ; Thu, 24 Oct 2024 19:38:09 +0000 (UTC) X-FDA: 82709506908.06.F17E20A Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) by imf20.hostedemail.com (Postfix) with ESMTP id 991081C001E for ; Thu, 24 Oct 2024 19:38:05 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=uuJVht6W; spf=pass (imf20.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.189 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729798656; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ygh5XAsyE1TzKPxIn/H04CcE11DeEBKZl9YsXiKRJ8c=; b=ttAtr2Y87kfoGtYUFCZtkccM+6MNnAOWXEfxxq8uFvfMWuQY6MuR5ZOVComMTjbXhQyBoh 0OHELZie3ImPbVU+Hy97dHtEMl6SpTeQEnvx6F0+nogRWsDStPx5X0izY4XXVuCihTuINt 65zlO6pDJt4PufW0hwIB5t/TANHQS4E= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=uuJVht6W; spf=pass (imf20.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.189 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729798656; a=rsa-sha256; cv=none; b=jRsOt7uOKRd7asrY8kjXxpq4L/BnmtjFm8gOiIO2YnBXahkvWHKmSK+W1H4KP6bQ92xm0y 62PnGNGOWo9HkPVqAMx77qgfIcqYubCKcnrVV+TVwjriXKDIrUo4DXyB1fTa/gUKr3uWWV EyKo95sK8UD7g8leh9MB5kd7fAcT7V8= Date: Thu, 24 Oct 2024 12:38:19 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1729798706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ygh5XAsyE1TzKPxIn/H04CcE11DeEBKZl9YsXiKRJ8c=; b=uuJVht6WUnsXQSm+f/Nq3lHvBqHu1NB1BTppL0W1zeEZF2IeV/n0Ab+H2v0O+uOEDKPY8B x3A9QmFME8FT0KbeyTXpXmlIY7+b/q/Q+geenVCVIJ/gt1+A0Ja5Mtf1zkxBDE/rK3LDZi LrFOQHFm5FoEM19Jti9PVhi7s0Z+/Zk= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Roman Gushchin Cc: Michal Hocko , Andrew Morton , Johannes Weiner , Muchun Song , Hugh Dickins , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, Meta kernel team Subject: Re: [RFC PATCH 3/3] memcg-v1: remove memcg move locking code Message-ID: References: <20241024065712.1274481-1-shakeel.butt@linux.dev> <20241024065712.1274481-4-shakeel.butt@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Stat-Signature: 9r3tz1towxwrpi5poood79b5x1j99e6n X-Rspamd-Queue-Id: 991081C001E X-Rspamd-Server: rspam11 X-HE-Tag: 1729798685-519368 X-HE-Meta: U2FsdGVkX1947m1X5Vz+soSYhxD04o6U6hrRLxBmTCVrTUao5HpmJ/6ZdwLrbSYyuHzBAZF0d88y1y4u/yxyvJqpkZF2hkjFX3Fna6wKD6LCS3edQSpWfmN7bl+htdATQDMXx5NRer7gPbuVAVjQXmVg8NDnu3ChHlqO8SyPUB4RW6+D/YOffHpEDa1ttJQALbw50FkKVOIJCJA7DQPtaBICKt2tMwMjLrGffl4zIWlrkhBJUy+Cpb4nWukssnJ/72rrUvN8Rd6WugD1sSfTsP1SW+w3h5U5fiNFdWVfoHf21Q8/LQK1w2qO+Zn8fpGcNbYC/MQdJzeAlhD/C0eVJF0vKQElyWZV3jmi6G54cZlNxgxmeE1yxq4hdRdqKa+4K2SAwgWh8Y40bzEUOgqkVNosNlwRiT7KGcXwUrsDtJFkHNdrhla2GgFERW1SxlXMIFq4IhSyRPRTYvMrwKtOCeChqvDfpTpyozuKl72W0nkICLu4ZjQw9lQDiAwQXCmxUgdwcub3zUSYkwLq5h8/OqQhYIOwHfXbaKPIMiiLmYmrxUBT3ULtJOO9J/CEpV+ZNPq0gpY+98Z9X61lqHJyROkVNiPnXn+p99JjffL3BNDgs3b2obMFgJwIditC2sSlDmgr1XZwpl7qLE/qsnUbjZC+Z2i9oL+Eap1eZG0D2W5a5Af1GOM/D0B9mjeRgyFccGkYwh+jEd76xYQAU2lSuez3WgHxfVYh1uRQ9G3J4lItZNaRpcviDoB8cWoDOBgEwSSpz/jZcHuZbR9aM337LhJpd/hJWPolfXuS2SSRMRJAUQ6MJ/GUtpUnZC5MlmzI+mVoTDbHFjn1vYBCW4KVmijAgrgm6+bv/6d3p8eN6qhYqQO17Kw20Tl2h7b9WbUuwVG1VDiGIdxqt0slmuchdeH0DEFV3M0hHXXi+ICPSTBT1lttFOiF0NmBNzp/l91Ax4D8f1EFk8PldbEtoqk K/cHgxfA Ps5LGh2CzEQACNN4bf72iWK9wUAt0+3ipKQlxr7QH26kZl+6GPvhJeDm4JAggeuZ8vJV27P8aVXTdNQSUnJ88hI7fteaBG6unK8ER5Lx7eVRMShmqn1eggYFIDW5dgR9mNwYHQ0QQtobP6O0hXv2hlz7HYA== 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: List-Subscribe: List-Unsubscribe: On Thu, Oct 24, 2024 at 06:54:01PM GMT, Roman Gushchin wrote: > On Thu, Oct 24, 2024 at 10:23:49AM -0700, Shakeel Butt wrote: > > On Thu, Oct 24, 2024 at 11:16:52AM GMT, Michal Hocko wrote: > > > On Wed 23-10-24 23:57:12, Shakeel Butt wrote: > > > > The memcg v1's charge move feature has been deprecated. There is no need > > > > to have any locking or protection against the moving charge. Let's > > > > proceed to remove all the locking code related to charge moving. > > > > > > > > Signed-off-by: Shakeel Butt > > > > --- > > > > -/** > > > > - * folio_memcg_lock - Bind a folio to its memcg. > > > > - * @folio: The folio. > > > > - * > > > > - * This function prevents unlocked LRU folios from being moved to > > > > - * another cgroup. > > > > - * > > > > - * It ensures lifetime of the bound memcg. The caller is responsible > > > > - * for the lifetime of the folio. > > > > - */ > > > > -void folio_memcg_lock(struct folio *folio) > > > > -{ > > > > - struct mem_cgroup *memcg; > > > > - unsigned long flags; > > > > - > > > > - /* > > > > - * The RCU lock is held throughout the transaction. The fast > > > > - * path can get away without acquiring the memcg->move_lock > > > > - * because page moving starts with an RCU grace period. > > > > - */ > > > > - rcu_read_lock(); > > > > > > Is it safe to remove the implicit RCU? > > > > Good question. I think it will be safe to keep the RCU in this patch and > > in the followup examine each place and decide to remove RCU or not. > > I took a really quick look and based on it I believe it is safe. > Shakeel, can you, please, check too and preferably keep your code intact. > I think it's better to remove it all together, rather than do it in two steps. > If we really need rcu somewhere, we can replace folio_memcg_lock()/unlock() > with an explicit rcu_read_lock()/rcu_read_unlock(). > Yup going through that and till now it seems safe. Hopefully I will have the update by the evening.