From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 09D1332694F for ; Tue, 6 Jan 2026 12:59:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767704361; cv=none; b=B6FJDORBIU0ZsmtCk4DSbEgpwyGws950Zp2ZzjWQy82uDw39FrBJtg+MBeEseHbIoRftFosUuzfHehVBIQBUvoj076uU2qvTGyMVNowQwsN6Cr6Pfj49b7cVXRtMmjGprvCbRmEPh/d8S54ZNv3jrh50+TKn102RuQ0dMRRu8r4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767704361; c=relaxed/simple; bh=U4V7cdkrzTYhbFWVdbjv2IHVbRBu5FkbWMuhD1NjZ+Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=G5ee8GyO1Zj6/co/IAdmG3bTMt6Or0uhhma5dISYDx3cf9E2oFxtrpWW1FMmNe6iS4zX4GFunwLbNdYzNtSsMhnrZwmPo/83AN5WpiLNdcR61/BHZH1LVZmWSHLNFC2KmHbiA5qpjjpZAX9rbiyJuEy3WCiaPjrhk0A3ya9uNzQ= 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=KlNwShYe; arc=none smtp.client-ip=209.85.128.49 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="KlNwShYe" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4779a4fc95aso13156255e9.1 for ; Tue, 06 Jan 2026 04:59:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1767704357; x=1768309157; 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=rISpGb7Ers/CHc+2Rz3qjUUFoRTwyiYj07UN2exoddo=; b=KlNwShYevjzs27IoPw7sWMvTkARzbHTwLbSiWFz5daW3AUenZ3gSSLXTdwpt/vGIve zrGaOse4wodTXa15d6+kzl0t92k/mYNR8Vs0cCeHiq0S5d6vQMOMk2YyMvw0BDTr17NN /34qn5UfBYOgPboT8NGs9EdPwst+/ODhd41iZoT26ShxbbTSmo5QXdDRyvWmX1h2qhCk +azTDnsOJIs2P39xRjCv2v6P/nUMBnmv6sPLZoJsNr+J7BO0jNwcV9stRmvITacBh+JC oROwwNo89HA6jNjfROCEnKeBtF8yBWQNUyZjvYyJzVo/bxU3yLvoOTPVM6V34eFZ/xXL 7oAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767704357; x=1768309157; 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=rISpGb7Ers/CHc+2Rz3qjUUFoRTwyiYj07UN2exoddo=; b=P5dAJzAfjFjN9P76lXu/jMX2hQWXfw04BO4+26ygtSz6JAuRjN4Abskj4TNC8xpokY N5iipgCyk5GgmUl7Wz13RiFSq8cN0GyMfGEs6OHAuFjnFPMJmkfy+odVrg4URO4y0R08 OkzjgaFQPHbh0KnPpqa9DguOU2FLAzgBC5pdRnTkf35wTuY1+RqFE71AFadL1qFyvdUD WHn+1MGGqmfgyLxe8EAL+TraiheGDzgDeuFpoXDy0tTdMbVpRqKDWdwfmW7ZN+8nX47/ u5TK2f7BpPjJfrmsSQ8yCwuJU/6uBiHJyXRlQ+ZOQ4yGDKYaMMgTSWfs+RgZglWh+dFG tHbQ== X-Forwarded-Encrypted: i=1; AJvYcCUGaN0Q1PDpdWwvghY6UY3lLdRZW+ImvqTWkKbVj4EbqVdwDi8id9+mXYIlY6N6FzvYQxWyXf7k8GigP1A=@vger.kernel.org X-Gm-Message-State: AOJu0Yz2f7N3Ruq23+pjC5dG3GqJPEs8k/NL5ZimqBgGOBRxG+Mr6KVJ 9bw12bqM0+CPX1BH3UK6N0NN6AH8eqkjRb4oEYiBMu37py95tZt1/eCPrHc3PQG2l+I= X-Gm-Gg: AY/fxX5bttZtd881wTuD4Plgid0hAzXTGWcr8b7UxsiitgirhZGGl6c05xH7SpeeAdo JdaQUennOQHkqRhXjgCVolOQ/N3T3H/mUZ5O16QL8YsUZ5zo2nSVURG9rlyLRe4FSxUrDtpqI/A vpRIH+1BGGO8sDl+lkATFAAiIeSlYbpSib1dIB/VS8a7eC65mwpuT9AFDshOkbqiuifCJMxNgEW EIFLk4syf6zWYfK8XFiy0TRwUS4s8tvX6oAL+7ucoRecdSGQEWeUegh4zTrL2a6rsUDalYcnhHZ lVfAm2SzGzKEdAMbfXejmM4ZWJnEtICLJBkGs8eH32UCbBfaeBQWGNTn2tPGjiUylRaeJM1mNhr EiiqzuogRUHqVop5JkuARWOLz8ZSuhDc70Taj01MCxeMPgjNCEmOwJxrgpMbrMARcD8ba1V1rRp 1PQce+Bf04/aKU/9EkU/H6RKsz X-Google-Smtp-Source: AGHT+IFf852uvGVgQ0nkdgKfOEZmXUesyAO5T04U3YI25fiDD+LhS3G4kEwKcViOOsd7mHC/fP6CUg== X-Received: by 2002:a05:600c:a112:b0:477:5639:ff66 with SMTP id 5b1f17b1804b1-47d7f627b7fmr30582205e9.13.1767704357166; Tue, 06 Jan 2026 04:59:17 -0800 (PST) Received: from localhost (109-81-90-116.rct.o2.cz. [109.81.90.116]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd0dacdcsm4237112f8f.1.2026.01.06.04.59.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 04:59:16 -0800 (PST) Date: Tue, 6 Jan 2026 13:59:15 +0100 From: Michal Hocko To: Jiayuan Chen Cc: Shakeel Butt , linux-mm@kvack.org, Jiayuan Chen , Andrew Morton , Johannes Weiner , David Hildenbrand , Qi Zheng , Lorenzo Stoakes , Axel Rasmussen , Yuanchu Xie , Wei Xu , linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] mm/vmscan: mitigate spurious kswapd_failures reset from direct reclaim Message-ID: References: <20251222122022.254268-1-jiayuan.chen@linux.dev> <4owaeb7bmkfgfzqd4ztdsi4tefc36cnmpju4yrknsgjm4y32ez@qsgn6lnv3cxb> <2e574085ed3d7775c3b83bb80d302ce45415ac42@linux.dev> <52cc0b2671b068903c6580b7431db0f22982ae86@linux.dev> 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: <52cc0b2671b068903c6580b7431db0f22982ae86@linux.dev> On Tue 06-01-26 11:19:21, Jiayuan Chen wrote: > January 6, 2026 at 17:49, "Michal Hocko" wrote: > > > > > > On Tue 06-01-26 05:25:42, Jiayuan Chen wrote: > > > > > > > > That said, I believe this patch is still a valid fix on its own - resetting kswapd_failures > > > when the node is not actually balanced doesn't seem like correct behavior regardless of the > > > broader context. > > > > > Originally I was more inclined to opt out memcg reclaim from reseting > > kswapd retry counter but the more I am thiking about that the more your > > patch makes sense to me. > > > > The reason being that it handles both memcg and global direct reclaims > > in the same way which makes the logic easier to follow. Afterall the > > primary purpose is to resurrect kswapd after we can see there is a > > better chance to reclaim something for kswapd. Until that moment direct > > reclaim is the only reclaim mechanism. > > > > Relying on pgdat_balanced might lead to re-enabling kswapd way much > > later while memory reclaim would be still mostly direct reclaim bound - > > thus increase allocation latencies. > > If we wanted to do better we would need to evaluate recent > > refaults/thrashing behavior but even then I am not sure we can make a > > good cut off. > > > > So in the end pgdat_balanced approach seems worth trying and see whether > > this could cause any corner cases. > > Thanks Michal. > > Regarding the allocation latency concern - we are already > in the direct reclaim slowpath, so a little extra overhead > from the pgdat_balanced check should be negligible. Yes, I do not think that pgdat_balanced call itself adds to the latency in the reclaim (slow) path. Mine main concern regarding latencies is about direct reclaim as a sole source of reclaim itself (as kswapd is not active). -- Michal Hocko SUSE Labs