From patchwork Tue May 14 13:11:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiu Jianfeng X-Patchwork-Id: 13664149 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 7E727C04FFE for ; Tue, 14 May 2024 13:18:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD2C18D0021; Tue, 14 May 2024 09:18:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A81BF8D000D; Tue, 14 May 2024 09:18:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 949108D0021; Tue, 14 May 2024 09:18:18 -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 744E78D000D for ; Tue, 14 May 2024 09:18:18 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 00871C121E for ; Tue, 14 May 2024 13:18:17 +0000 (UTC) X-FDA: 82117055076.27.524C32E Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf14.hostedemail.com (Postfix) with ESMTP id 5B585100017 for ; Tue, 14 May 2024 13:18:13 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=xiujianfeng@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715692696; 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:content-transfer-encoding:in-reply-to: references; bh=Q8V3hdpwL1wGvuEOSlpLcRgdkBEzexJVsO59ECPAhPA=; b=53butvJesH8u0SFeiYs7enEnfFA1NEHmWz3kztBg+2fnBVKBdr7KDghb/2Enru4JRFyBhA 2zp+mg7WsjMnYsSc1Hd0gL1fnpqYC9+p/csqkNxI2Q8FstdfPJfqXPVwydnbsTxg6PqYKs aG137jYRNEFhBqFLiV157kl7nv2laBs= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=xiujianfeng@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715692696; a=rsa-sha256; cv=none; b=EJsLhDN3daKul3Cb43IB0d/SEtSxNbCM10AIxLQIkWS3kMKdyfdN8CeysVVJelo79029s8 FH01fcVph//4YIsBivaHE7umqoTBO3ZMZPr0+KRsDG72zWRFF1ykFquuvl+ccem9DuOacd kaYfeXIOekP3JyUOzgMUiyfNsarJGow= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Vdxf438tkzkXWs; Tue, 14 May 2024 21:14:36 +0800 (CST) Received: from dggpeml500023.china.huawei.com (unknown [7.185.36.114]) by mail.maildlp.com (Postfix) with ESMTPS id 41EAB18007E; Tue, 14 May 2024 21:18:09 +0800 (CST) Received: from hulk-vt.huawei.com (10.67.174.26) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 14 May 2024 21:18:09 +0800 From: Xiu Jianfeng To: , , , , , CC: , , Subject: [PATCH -next] memcg: don't handle event_list for v2 when offlining Date: Tue, 14 May 2024 13:11:06 +0000 Message-ID: <20240514131106.1326323-1-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.26] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500023.china.huawei.com (7.185.36.114) X-Stat-Signature: cu8jfdbtgfmknus594qd3qcmy4k39fea X-Rspamd-Queue-Id: 5B585100017 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1715692693-362239 X-HE-Meta: U2FsdGVkX19JXRPzelFtn9xFMM8Wjv5yhCWHnr3MiQ1llGZxAVmEMMXad866I3QA/RJQQRLCTYgDzLNNFegaQ7Sy939YAo/bxJaZn5uVHpEDTls+5OZm2xH3wjmmPQMd/5TLgPX2sfs8skzB2Lot4Bnaz1w13oA2fZej7l3vBVBxCWu7qxgLvm11SXOEzpx/0QU/xE95V+qCJiA0YvhvpSQzlcFZE3btqyPN3gFqVbFnqg3rcpSJXIS/IWYqfljXJZGstyre1cOyu7t6vSxh2ljM1Fd9X4yDB4gGgxFQ8caL5srebCSJITVLR00Y/8sFCgJjVraJWORzBEU6Qn//eRUjSZJBwQr+65IjNu+zeh0DqpYvoDaEPNny4tXcYg5o/2D+nbN8w35LwiClAkaDCnm0MfbC/0Y8r5x6wh96rxw48mmmn+pOk8yHs8lwI3jn4C8ID/UnDBq4a6usiqpQ/7y7cqWBak7/vOe5LT8Ak6l9M54upOpXoiIjs/4m7PNDBIdJ6z7+i0kQBTHrpIbSHiiFYMTHNT+37xbmX+y98rbwUaxf14HLl3d5LhtFlfT6uiAgJlOvHF/uL1l0eqtgYga24Y138I59S+fDDnwXtFQR/ByH0N9PJQvaq47WjsnQKOHek2eaWVF5eW1JU7xCuvz8wEPzkEGTQUTmt4w5Oz0bD1gO1qcJJCrD2QefZzweyBYDRgVVGj51j9xdJCyaAlfJitla7uyUdworI3M2P+OMGQm2I9xqtFS1A2YGPWfM5fC9hpVFMJmc9eHq2e/EE0l9YwMdv7n2PGFlgqYCehVT7d/7TGORyE8nnnoViZDAezQUVfEWODOJHVffrBhssJMI/5s+usTe5JcN6VtXyUDvpAyDyFj+Akubaxi+kHH9sgXA8eUIriKVM2uQMM8oFEmmEIcRCMWr6gsdJ6kJu6Gx7jl+dGJ4kZXUwmXlIKvrqz9ekhtgWRM2KPHj5va eBkJrA6T a763TBzJ/SKnUiRO9YQyiSRd0nRIVGrmxIezO/zxx5P02N0r9Tj/1nAfkAM1zDTmsOTQS2JthZL36Ne898Q8uws15E7fK+BveB5X/XR6GjM9tBfLyTOt/58o9bPca2TsIXVKqcxt4y5rCyDWwasQyoDm1yHG8vngrvbu30Qy1DF/i07uGmWf/Elu8ZC2oaHWF98Zd 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: The event_list for memcg is only valid for v1 and not used for v2, so it's unnessesary to handle event_list for v2. Signed-off-by: Xiu Jianfeng --- mm/memcontrol.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d127c9c5fabf..4254f9cd05f4 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5881,12 +5881,14 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css) * Notify userspace about cgroup removing only after rmdir of cgroup * directory to avoid race between userspace and kernelspace. */ - spin_lock_irq(&memcg->event_list_lock); - list_for_each_entry_safe(event, tmp, &memcg->event_list, list) { - list_del_init(&event->list); - schedule_work(&event->remove); + if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) { + spin_lock_irq(&memcg->event_list_lock); + list_for_each_entry_safe(event, tmp, &memcg->event_list, list) { + list_del_init(&event->list); + schedule_work(&event->remove); + } + spin_unlock_irq(&memcg->event_list_lock); } - spin_unlock_irq(&memcg->event_list_lock); page_counter_set_min(&memcg->memory, 0); page_counter_set_low(&memcg->memory, 0);