From patchwork Fri Oct 25 01:23:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13849920 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 6369DD1038E for ; Fri, 25 Oct 2024 01:23:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E684C6B00A1; Thu, 24 Oct 2024 21:23:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E164D6B00A2; Thu, 24 Oct 2024 21:23:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C424D6B00A3; Thu, 24 Oct 2024 21:23:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A21836B00A1 for ; Thu, 24 Oct 2024 21:23:42 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 45C9F1A02A7 for ; Fri, 25 Oct 2024 01:23:08 +0000 (UTC) X-FDA: 82710376896.23.339C403 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) by imf16.hostedemail.com (Postfix) with ESMTP id C9ABA180005 for ; Fri, 25 Oct 2024 01:23:21 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FyQBMk5A; spf=pass (imf16.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.186 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=1729819268; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7wiuyjy0zmQLWgqvTUEEYQB7YbC8EAAKeOqIvPyT1kA=; b=Ph7azDF0VeJ8frYa5n+OopR7iv5xJswrnxLXx8HpAkEruuYk0VmGuTnpYFzuBlXglYyRdR ZJJFsp5tPtgrA7sztuHFJbCCxcd8EGCUg66diqYtD8dMawyVGgHMawrPvgZ9z3I5sMAC1D 3LyFUgX796W1cVFW/wyYHrDnMbNgxk4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729819268; a=rsa-sha256; cv=none; b=Y4Bu3/4QbedFZrD4EDc0jwiMp71jr5cd+2T3+FMlGcUfFoN6id+gEcrJWiVic1mIIjG/wz t7ayOkB0/5Q+RD5obqqzl/1Z0gZYdCihY6EeZFUEYL02KqNp5RxL2gB8r+SW+T4TeBgtmr x18levDy91dEVMAPZbiqLT+M+6mJQQE= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FyQBMk5A; spf=pass (imf16.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.186 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1729819419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7wiuyjy0zmQLWgqvTUEEYQB7YbC8EAAKeOqIvPyT1kA=; b=FyQBMk5AhTU+B75oVA+oWUlAvWNvk+tsSDX0Snyy95VoOAUeapV7M6ETpL7FGJzvOFBblq h1ob8GVon/ncRKjwN1/gbkrdP2Q6N/PGtjFTKB5tsUnTA8uQOkhNwestaeF4grzP4JmMTn PxF+k0emd7XdYjJE4En9YYVB5PEuewc= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Hugh Dickins , Yosry Ahmed , 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: [PATCH v1 4/6] memcg-v1: no need for memcg locking for writeback tracking Date: Thu, 24 Oct 2024 18:23:01 -0700 Message-ID: <20241025012304.2473312-5-shakeel.butt@linux.dev> In-Reply-To: <20241025012304.2473312-1-shakeel.butt@linux.dev> References: <20241025012304.2473312-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: C9ABA180005 X-Stat-Signature: xg31fu9xbgmagheyoyh5zgimsf69y1wi X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1729819401-578340 X-HE-Meta: U2FsdGVkX190eqt+6wBL+oirRb7kwtc4AVGe380HQs+s4nIs3evP0EpnyCBsaRYyWQnS44zVMJdo7mwUGCvIREdnfzkRalEB09bnjNlsXFkkZrAR1UqHzfjVbIWQwGgYINKnNOVjOxl2E2qzsHboi3kFz+x8JVFhTwstUz50VL9kNrEBMmm0rJ7JJmcSdmaUp+ayna25P7eMYHf6bATx5/U4DH3pEiqA1f8HWqGtJcucOftvQ0KWH92Ir2M3OjESDkh2xqf8LP4g6C7FFJngEKw4cguoV2AYGE983mVg8gFhoaGeyv7vGjZsrCUw4u1yhoUnqPXyfrKFRogbaK4jso/JAiqwt2Q22Kc6tuzyGUs2byxX47l++nyZVeWHd30mDs6W6Y3coxkZQ4HoYG/4pGn6kWnG8JzspL/JzAIt+qeahPDH8164jVQfY/YrvVCByGywBtg7qXnh3h9LMvFsyZ00oXHdlhtHsPrtbodeyHKiEMJ62kqyB64gWoD6mMJ0HP0eJDp9q32aAsjMGNQBbOUgy4LIcwYnnYMidtQw5nqeKtyJAaIbfSwNcAz7wQimSsZkqliTlQIhKh/hXoDH8yxL522x4V7hYBqzLNO4QwChBOEGbswoT7hFO3gunaOfnGKdxKSARSSlEa/8x0W9sC2DfuND9gNYfjQbpDM3t2Svp8QPdYA0H/uEH9PdWpZUUX9YVW2b0QgkVqITmTacY3DLLy80jAL5IcEpKhfRNuFvtcMDJ7YqTJ31ugmBaZq+4nf1LjMzytzZ8nCaYI//vGAL4yM48NFjg8sEfINFkrAtLZtJZkgfNLVuio799v51JN9sunNEKfK6T+38H8h+zipKbIxRsELtB4Hd1iGbNi5lROBD05jaN13OJd0FBHmiijSFvEK0aGpyh+nXDiuBgqdVXHRw2FA6K8/w8tePRZL3KH2Uw7n+Yruro/3ky2hfQh72J1lsQE8bMi4C633 TgklBu+J 4ewxaJ1+Te83xn/AAQQNbTdqgsZ0si/ebTimLMjLORqyY/tnQoqFeX0ZVJ5lG8gsVFXxz9KLXq/7nAAx1z8uCvZTS/7Yp3nbmyoZO+YmtuHO2krd9DdzK476Qy6osINYZjzzHdQ90X2KjwIQ= 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: During the era of memcg charge migration, the kernel has to be make sure that the writeback stat updates do not race with the charge migration. Otherwise it might update the writeback stats of the wrong memcg. Now with the memcg charge migration deprecated, there is no more race for writeback stat updates and the previous locking can be removed. Signed-off-by: Shakeel Butt Acked-by: Michal Hocko Reviewed-by: Roman Gushchin Acked-by: Johannes Weiner --- mm/page-writeback.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index a76a73529fd9..9c3317c3a615 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -3083,7 +3083,6 @@ bool __folio_end_writeback(struct folio *folio) struct address_space *mapping = folio_mapping(folio); bool ret; - folio_memcg_lock(folio); if (mapping && mapping_use_writeback_tags(mapping)) { struct inode *inode = mapping->host; struct backing_dev_info *bdi = inode_to_bdi(inode); @@ -3114,7 +3113,6 @@ bool __folio_end_writeback(struct folio *folio) lruvec_stat_mod_folio(folio, NR_WRITEBACK, -nr); zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, -nr); node_stat_mod_folio(folio, NR_WRITTEN, nr); - folio_memcg_unlock(folio); return ret; } @@ -3127,7 +3125,6 @@ void __folio_start_writeback(struct folio *folio, bool keep_write) VM_BUG_ON_FOLIO(folio_test_writeback(folio), folio); - folio_memcg_lock(folio); if (mapping && mapping_use_writeback_tags(mapping)) { XA_STATE(xas, &mapping->i_pages, folio_index(folio)); struct inode *inode = mapping->host; @@ -3168,7 +3165,6 @@ void __folio_start_writeback(struct folio *folio, bool keep_write) lruvec_stat_mod_folio(folio, NR_WRITEBACK, nr); zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, nr); - folio_memcg_unlock(folio); access_ret = arch_make_folio_accessible(folio); /*