From patchwork Tue Apr 1 17:09:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 14035200 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 E7E8EC36010 for ; Tue, 1 Apr 2025 17:09:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 937A2280002; Tue, 1 Apr 2025 13:09:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E655280001; Tue, 1 Apr 2025 13:09:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D497280002; Tue, 1 Apr 2025 13:09:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5F6F1280001 for ; Tue, 1 Apr 2025 13:09:40 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C21F3140640 for ; Tue, 1 Apr 2025 17:09:41 +0000 (UTC) X-FDA: 83286111762.15.B6E8D3B Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) by imf19.hostedemail.com (Postfix) with ESMTP id 045BA1A0013 for ; Tue, 1 Apr 2025 17:09:39 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=VJ18IaoB; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf19.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.177 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743527380; a=rsa-sha256; cv=none; b=53GMz2SLVVui3VvP5sVwnWZyUBz+qAMts6bO5THGSVoGTdtU3UmnxugGQNSGVrpSEuBreC lQu7vW7WkGOcNX5UpSl1SF3FlYbevfhtXAxlPI20gVfXovOF79Kpt1kNfD0rZ/Ru2HnUi+ wTksP02Aa3gMOJjrd0Juafz0/LkGwso= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=VJ18IaoB; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf19.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.177 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743527380; 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:references:dkim-signature; bh=kBnwje6boVgUJxbB8QyKCSQJNJwRZTVBfAi5NgyEuuA=; b=JSJ5QBOTMvqW4L+X40b0m0UymlvZiVe5y/SjbNAzReMnAzlQlxx1QogMUqmSzCD9tGrSbR VjXEEJGx6CHZ5eKiXWtiWGHt2z1Dp4+PF3RmzRXT1wvLaR3ZxAynQR3An61GNr2RiMm7h6 65zO20UVvgxDvkXi3Zq3wC01wIA5JSE= 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=1743527378; 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; bh=kBnwje6boVgUJxbB8QyKCSQJNJwRZTVBfAi5NgyEuuA=; b=VJ18IaoBTFLbEqhjH/GJqSFX0CUSbMuXtCDIkqBd9RlIgYodyDWiMcVSRWvX9/mEIMTqyU 7qRcv7bLgfI+skHZYiqcEdbVNUjEHKMFcfkzvuV2wWmXNE5z9OInfX6RpUMJgef/FRBClH RGpUIO8Q8JqC+eZyfJOcA3UM72wPBF4= From: Shakeel Butt To: Tejun Heo Cc: Johannes Weiner , =?utf-8?q?Michal_Koutn=C3=BD?= , Yosry Ahmed , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Meta kernel team , Jakub Kicinski , Breno Leitao , Venkat Rao Bagalkote Subject: [PATCH] cgroup: rstat: call cgroup_rstat_updated_list with cgroup_rstat_lock Date: Tue, 1 Apr 2025 10:09:12 -0700 Message-ID: <20250401170912.2161953-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 045BA1A0013 X-Stat-Signature: jy5mw5gspsyjm3393kdthaotgksi3osb X-Rspam-User: X-HE-Tag: 1743527379-883326 X-HE-Meta: U2FsdGVkX1+bCq8k4eDHE6JHLEhzOC0mqjXGrMfJGlf821ehxd6v0ivuWgVhAvtPXltZmbrct82/GzfTBnQcKyCn0et87wXT0DAuxpZcWyZuifm69meUiEnVjxXbrDRFfz7pre0e7kv7naM5QkOAKMhNklJvck5Siks9hHbLT3WVXRnWFlLfVLnajvCHVnBwkUzHspQvfx+tFnyZzYBOeBtU7ZbUqCS7mb4/xMxyXEYmX+swIlVnJSPrWwRQEnVrGH6boFCYkcZ3LY5N0cv+b1U5Ec5E14DpmKVsaZa4TAkJldCTlraIoqJ8tE+0X2/gOYJTtgi1jBWwQf0cfk05EJU6uU1HFI5wUedriLQjYor0YpYOg0QqMIGHqUEglWiHpjQm2fmmTnq3VGzo5JGHrcpMF8DYJPSAwrV0IzwGqNCvrFlgaoBXv3veQcLbpuW3J3rxcP6aMk3TtWLfJn8caSzbts7mA4CvbV1PtYcpkAmAUb41ttxLYNx1lFbkS+uWFIuDhnpkSXluIUMCHrayEcoANNFHrUWw/rvuCDw9CIUSm5stKdwElWAxwVD9jJTExLwSqHV1rH6Z+HwHo2qZHerPcM53Fq5flQ8y0vtNS+tHwVw+w8nNnngi5TWkxhxzkYnnujAVygsFoElBlyqPWAwkRMRGCgwixmmVMDuymQu2PBpoliOje0mEgKRFbC2Nki3iTy4/Jdf7VFx0eNKEd4RKz/8w4f7lx8mdx1eMBhsbin9S+nOnfGV1x6H7kdEC/OvR2J/ayjik1BZWMEjsKypCw5QG1EcfN1sBg+PwuYnoV7O3Si76nsk1hNyBZ2kqNliHhhjSp/EkRrtYeeL+dafYNFOpZfFIpCYC8Iu6XCTaKuxErssTARn86k/epcj+jfQJpWdNwLy1DZ4LN++SL3mPKliV2605l/GyKN4BbGpGxpRyAUQf7g8L1L/nOkMa1BSiRr7aLO1Y4FV++JG Fusq8t7h KP+qCZiW1AaPj+NOoKE7qTamTLEAyj4ANRgNP8byfCb8CzCl5U+zUgsUqGp/OowAKEh1qSrYeHjgow3B8pmTDTPewtx51BttMRqapJ7/vrsziFHN9yLYMOQsfCKF61C/8viIWfMbcnSQ1GP/cd2bN/aqTmKTkP3eGIL3KusMUHSAv25qBocqcQkcZ6FcmDdQ3QnIXTsVVohbi6pVKuR6iUcRVXr/Zg+szrUFVw8oV+NFI08KjFE1EK5apgpWMESf+yLDoW1VyRa7fcwSoqgCYU+cbxJTkfm2W1ICa 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 commit 093c8812de2d ("cgroup: rstat: Cleanup flushing functions and locking") during cleanup accidentally changed the code to call cgroup_rstat_updated_list() without cgroup_rstat_lock which is required. Fix it. Fixes: 093c8812de2d ("cgroup: rstat: Cleanup flushing functions and locking") Reported-by: Jakub Kicinski Reported-by: Breno Leitao Reported-by: Venkat Rao Bagalkote Closes: https://lore.kernel.org/all/6564c3d6-9372-4352-9847-1eb3aea07ca4@linux.ibm.com/ Signed-off-by: Shakeel Butt Reviewed-by: Yosry Ahmed Tested-by: Breno Leitao --- kernel/cgroup/rstat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c index 4bb587d5d34f..b2239156b7de 100644 --- a/kernel/cgroup/rstat.c +++ b/kernel/cgroup/rstat.c @@ -318,10 +318,11 @@ __bpf_kfunc void cgroup_rstat_flush(struct cgroup *cgrp) might_sleep(); for_each_possible_cpu(cpu) { - struct cgroup *pos = cgroup_rstat_updated_list(cgrp, cpu); + struct cgroup *pos; /* Reacquire for each CPU to avoid disabling IRQs too long */ __cgroup_rstat_lock(cgrp, cpu); + pos = cgroup_rstat_updated_list(cgrp, cpu); for (; pos; pos = pos->rstat_flush_next) { struct cgroup_subsys_state *css;