From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 179982C21FF for ; Wed, 3 Dec 2025 08:27:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764750456; cv=none; b=fen6cSBxR+tfGXWCeUuMyFg1XyyFcL2BwA9SFMA/AOL0J2Bm/jdYqQCN1u713XHV+3mefhyVXinsMZF0p66fmXl5wvN+nF7KeWE5D50rizrOJSPNJSfYiUDwObkA5H8QUiD2v0CTaT3fSDsskTxea6SMUQTgnp9Ixw0h7SH9o4g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764750456; c=relaxed/simple; bh=DzGsvgvS9U9hKUIFwXplBErNtFFIut6GKr1n+ym7lmw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=C6YoLyw+v+9Cbsrs0++Xyzh+nOraJu38DyNLejTD5Czhys1l9rY21pGBMn8kZ5Ps5Y1+E25FOgCnVtcMLdo+JK5mXXpgltaP64omdaJv8tO/6ZFeVqRf1BOGNRH1JLhPGpkRN7+/pvp+HPXBes4sTGsF1LCUt+az621W2t3j81k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=aX1ENd/X; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="aX1ENd/X" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-b75c7cb722aso915695166b.1 for ; Wed, 03 Dec 2025 00:27:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1764750452; x=1765355252; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=LB82SqHK4Qa55lhUfpaEjxDuzOxGP5U8vTnPeLr/2UE=; b=aX1ENd/XK5I9xrNBhvpBPvQG7ldf0FVkYGC5CPWtxT+PZEj1Xe8BRom+DWrMhALxQL bWfzLmfxeCkcERVWxigfMqMv6HkJLq0bT4IKIGm5jdHEoPRP/lISoJRofXGefRxyq0dr qjzr3dJbVeEvsbYGHuuAzLuJZ7sMc1YIpdBIs/SoGNsxY3xa8D58aL46jfnDFkJYk/0T 7nN/HGbWOwtJIqy79ETwGJYfigVK50tJ+Z8JTbTyOqpDMfZPXdUb4QwrtNVfzhPeguYp 25Cd9JGHM9DIE2Z+GL25Pxb47Fom88VQGC7cFIdKKnTfPAbTyBjVCbdRjyykvor761Ji 4YQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764750452; x=1765355252; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LB82SqHK4Qa55lhUfpaEjxDuzOxGP5U8vTnPeLr/2UE=; b=uwGmyFCoVqUpNdHa7ujoAPZ3oDWB9qI+Q4Xldv46239+0f9Xu/VW85FgD5j1T5QPfP Dpelfa2xpbHv9jL/7Lwy7FWbVcOwewMgTpj5mAbuqf08wBv7qC5zHl2BNpYbDL1KtYbU OXUGhBF1wQ44TVwRiSHgn6BiRpM0BIgnaTqEihd8SyB12T5wU5E+DOIvPAlxk/ocZD9O AkWWPaPLzvxODZCKmN8E5j2lBl7AUeGR9ohhdfAZuz2yXkhTwJ0AKHodvFeeJaVBGUKZ 2lSm57AYSKUKehFT4Q9uV9SRhXEDpzILkVDVncNcU142WTdHoPsL5BQsAUsywquiR50J 3ELg== X-Forwarded-Encrypted: i=1; AJvYcCXBGZ5Ixm0BjOHG5A1+EXt2sGmZAw5QRFKZ2xm+WsPTM52GXNsxVI/GNi2B3wfFuybBed1grrQiAD4Qs68=@vger.kernel.org X-Gm-Message-State: AOJu0YzmImeUEsuED8NFq4BY2z28wHU4Xkl+JvMgsJg1R7WYIsEJ7rkx F86uDw5WW5VQG8W8JAhaVi4GzZTeZsNQ46XFsvQ+Ltp2Ft2Ajn1nhR3PyAnsU0WChwU= X-Gm-Gg: ASbGncu7xHGzTZjQ9MrDIDmzuViiZsmlA9bYIIZT1WLt/imu/7II3JSvwlqaqUcMGxY 72kXM8VxgbKo9C835pzzzlAW6S5DCUnEBrB/9CWpyQcMQK5QY6NOL+3NQO1rsT6obcZ6rhshzCT i+9FfjWHBBbW1y80CXUA3GmlehVHFW7kM55IXQEl/WOeItBeWVMudtwBQGo797NpxMxGigeTnqD yqXhUZqRwOGdnkGYOXuK7jbCkvK+BvGBe/jnxBt2pD4TDeJcSvphcPkfYw3siAFd4SyFYB0/PxL l2k5VqHUgsGGQgIQYW1W22vyb/veid+HelMORvFCITKR4Nry1Esv/1Dgm2WU4xU3JWRDjwA8mjs gGSlnauxslujNFeSkh6DG0KJfud3KlSKo7WmxFNIP0x1phCrpxXL5KQhtcQQ4wVrxYGLSu2Aywu g9es1OR83S8x8XeTHGAlN0R+sT X-Google-Smtp-Source: AGHT+IEK5WibNLplvHwt2NXZj0T7f+oFfDBpB0TAMbBC3XmPgxwZI3ByUT0m16wi3I/b1b4tBF5B+g== X-Received: by 2002:a17:906:6a08:b0:b73:4006:1875 with SMTP id a640c23a62f3a-b79dc51d9a4mr145015266b.38.1764750452266; Wed, 03 Dec 2025 00:27:32 -0800 (PST) Received: from localhost (109-81-89-155.rct.o2.cz. [109.81.89.155]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b76f5a4b926sm1729121366b.68.2025.12.03.00.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Dec 2025 00:27:31 -0800 (PST) Date: Wed, 3 Dec 2025 09:27:26 +0100 From: Michal Hocko To: Andrew Morton Cc: Aboorva Devarajan , vbabka@suse.cz, surenb@google.com, jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador , David Hildenbrand Subject: Re: [PATCH] mm/page_alloc: make percpu_pagelist_high_fraction reads lock-free Message-ID: References: <20251201060009.1420792-1-aboorvad@linux.ibm.com> <20251201094112.07eb1e588b6da2ee70c4641d@linux-foundation.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251201094112.07eb1e588b6da2ee70c4641d@linux-foundation.org> Let me add Oscar and David. On Mon 01-12-25 09:41:12, Andrew Morton wrote: > On Mon, 1 Dec 2025 11:30:09 +0530 Aboorva Devarajan wrote: > > > 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. > > That's pretty bad behavior. > > I wonder if there are other problems which can be caused by this > lengthy hold time. pcp_batch_high_lock is not taken in any performance critical path. It is true that memory offlining can take long when memory is not free but I am not sure we can do much better. I guess we could check contention on the lock and drop it to make cpu hotplug events and sysctl_min_unmapped_ratio_sysctl_handler smoother. The question is whether this is a practical problem hit in real life. > It would be better to address the lengthy hold time rather that having > to work around it in one impacted site. > > > 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. > > > > ... > > > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -6611,11 +6611,14 @@ static int percpu_pagelist_high_fraction_sysctl_handler(const struct ctl_table * > > int old_percpu_pagelist_high_fraction; > > int ret; > > > > + 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 */ > > That being said, I'll grab the patch and shall put a cc:stable on it, > see what people think about this hold-time issue. -- Michal Hocko SUSE Labs