From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35DC33148AC; Wed, 21 Jan 2026 18:34:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769020491; cv=none; b=iMjqg00M3jr4PPMW59w6uCBtZzIlhQhPX4s0OZESh31+kUik4C0QvnfKlVZg86taxKFal7jidtXSFRTLL5w9QIJ6WMgql5WJmQrSQKrNn04UiwD+i/wu/NvNeDmvR1QLyc8omjCk8/Ee7WpxtWdTIUtOFyX/A/8lnQmr5hH//+Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769020491; c=relaxed/simple; bh=K5u7B+0YRfKsz/+QKTwQEn3VVISUS65+CGv6xf/7FrU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LS6lTDUZ6eNRerlmytuhhzLMbEa8forlPrCJ8S0I1WOcmhEU1Q28JHKNYOSBlP+iOVJhZtW2iowX8WDdogAL5JdIZ4SNu723k/refzjYw7aRpdLmT3sGj9d9Uz4kaZ67ctG6PbVSukOei0sOk4CjwZsMgfuwZv2o6vN1FOM7l50= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mhnpa0Od; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mhnpa0Od" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99083C4CEF1; Wed, 21 Jan 2026 18:34:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1769020491; bh=K5u7B+0YRfKsz/+QKTwQEn3VVISUS65+CGv6xf/7FrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mhnpa0OdQGYPcAT67kRxWx6wrPqxxEqFvpy6bMnFXvrSzSSYvivtzZ7K31U3gu+e9 c9XWw9i+9u+CR0EjKcf5jVFKeaJRflHRK6MzOA3WmgDrssNaRmqF/1jyuO0iP97dn6 CO3Auwg/GXhGcgMEDnMuEDOULh96cBdlrsPUHN8U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Aboorva Devarajan , Michal Hocko , Brendan Jackman , Johannes Weiner , Suren Baghdasaryan , Vlastimil Babka , Zi Yan , Andrew Morton Subject: [PATCH 6.18 141/198] mm/page_alloc: make percpu_pagelist_high_fraction reads lock-free Date: Wed, 21 Jan 2026 19:16:09 +0100 Message-ID: <20260121181423.626882426@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260121181418.537774329@linuxfoundation.org> References: <20260121181418.537774329@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aboorva Devarajan commit b9efe36b5e3eb2e91aa3d706066428648af034fc upstream. When page isolation loops indefinitely during memory offline, reading /proc/sys/vm/percpu_pagelist_high_fraction blocks on pcp_batch_high_lock, causing hung task warnings. Make procfs reads lock-free since percpu_pagelist_high_fraction is a simple integer with naturally atomic reads, writers still serialize via the mutex. This prevents hung task warnings when reading the procfs file during long-running memory offline operations. [akpm@linux-foundation.org: add comment, per Michal] Link: https://lkml.kernel.org/r/aS_y9AuJQFydLEXo@tiehlicka Link: https://lkml.kernel.org/r/20251201060009.1420792-1-aboorvad@linux.ibm.com Signed-off-by: Aboorva Devarajan Acked-by: Michal Hocko Cc: Brendan Jackman Cc: Johannes Weiner Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: Zi Yan Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/page_alloc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6611,11 +6611,19 @@ static int percpu_pagelist_high_fraction int old_percpu_pagelist_high_fraction; int ret; + /* + * Avoid using pcp_batch_high_lock for reads as the value is read + * atomically and a race with offlining is harmless. + */ + + if (!write) + return proc_dointvec_minmax(table, write, buffer, length, ppos); + mutex_lock(&pcp_batch_high_lock); old_percpu_pagelist_high_fraction = percpu_pagelist_high_fraction; ret = proc_dointvec_minmax(table, write, buffer, length, ppos); - if (!write || ret < 0) + if (ret < 0) goto out; /* Sanity checking to avoid pcp imbalance */