From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 53AC13B05BC for ; Fri, 21 Aug 2026 08:18:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787300311; cv=none; b=kCALz6eO36welum29d9LJcdWAnKVneJ6qKtWzOgF9PjG452iSXpTl4Z+tuFwqhQkfKnpztTZTfFvQj4A2F3yDHppFcD65DHl0zLMHkTJ3cWml0zeRUTSm9g0yNRU4Zrr21HYTEuEAHE5SG7ZrtU0nT0rf1c4ggwR0xzdEdldWyc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787300311; c=relaxed/simple; bh=ZAscUiHq/rYEWDhnt5RfykoKmzATq1btSoHBcxnZeVk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pmAXW2UMPHFZgrUg3OI9Eqxqklkc0JyYFN8AdrfLAwskAIDuKYZD2yzSBD5/OBTK3G6PIrKGo4sUihpJexYnZpUhyig3jHRkWjfAdfIxt3naSOWGxQJri57LBQyk3QO8ouxwyMYzXxHTDPuf1dTRRmhI35Hny1vNK+5U1/ibAGI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=hJDuNPG/; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="hJDuNPG/" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=ZAscUiHq/rYEWDhnt5RfykoKmzATq1btSoHBcxnZeVk=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1787300308; v=1; x=1787905108; b=hJDuNPG/aIrW3VicCgnYHMPfZFZcSKAzqkrKsTLse2VIpQ+LXI0Lc8Z/t8Kt9/MNARyi+lAO zJxztGQe2GX1ukUqyOoRSYY3f4hvV8TDVqCR2+VZoqYhdeuolzlyU01k5+Aj+nszdlDwxKMx/Ku nPmZFeepM4GaB5y5mUn7Ahk0= X-Envelope-To: linux-kernel@vger.kernel.org Received: from mi-ThinkCentre-M760t.mioffice.cn (14.29.108.92) by smtp.migadu.com with ESMTPS id 9be2503217972ce1; Fri, 21 Aug 2026 08:18:27 +0000 X-Mizu-Trace-ID: 9be2503217972ce1 X-Migadu-Flow: FLOW_OUT From: Ridong Chen To: Andrew Morton , Johannes Weiner Cc: David Hildenbrand , Michal Hocko , Qi Zheng , Shakeel Butt , Lorenzo Stoakes , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ridong Chen , Ridong Chen Subject: [RFC PATCH 3/4] mm/vmscan: drop the combined limit gate in __node_reclaim() Date: Fri, 21 Aug 2026 16:17:40 +0800 Message-Id: <20260821081741.1340277-4-ridong.chen@linux.dev> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260821081741.1340277-1-ridong.chen@linux.dev> References: <20260821081741.1340277-1-ridong.chen@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ridong Chen __node_reclaim() only ran shrink_node() when unmapped page cache was over min_unmapped_pages OR reclaimable slab was over min_slab_pages. With slab and file reclaim now gated per type by sc->skip_slab_reclaim and sc->skip_file_reclaim, this combined gate is either redundant or harmful: - for the NUMA node reclaim caller it is always true, since node_reclaim() only calls in when at least one limit is exceeded; - for the per-node proactive reclaim caller (which does not go through node_reclaim()'s checks) it wrongly suppressed all reclaim -- anon included -- whenever both page cache and slab happened to sit at or below their limits, even with plenty of reclaimable anon present. Drop the gate and let the per-type flags decide what to reclaim. The node reclaim path is unchanged; the proactive path can now reclaim anon as requested. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ridong Chen --- mm/vmscan.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 1e56973ceb73..5a3f67b3ba32 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -7906,16 +7906,16 @@ static unsigned long __node_reclaim(struct pglist_data *pgdat, noreclaim_flag = memalloc_noreclaim_save(); set_task_reclaim_state(p, &sc->reclaim_state); - if (node_pagecache_reclaimable(pgdat) > pgdat->min_unmapped_pages || - node_page_state_pages(pgdat, NR_SLAB_RECLAIMABLE_B) > pgdat->min_slab_pages) { - /* - * Free memory by calling shrink node with increasing - * priorities until we have enough memory freed. - */ - do { - shrink_node(pgdat, sc); - } while (sc->nr_reclaimed < nr_pages && --sc->priority >= 0); - } + /* + * Free memory by calling shrink node with increasing + * priorities until we have enough memory freed. + * + * What to reclaim is gated per type by sc->skip_slab_reclaim and + * sc->skip_file_reclaim. + */ + do { + shrink_node(pgdat, sc); + } while (sc->nr_reclaimed < nr_pages && --sc->priority >= 0); set_task_reclaim_state(p, NULL); memalloc_noreclaim_restore(noreclaim_flag); -- 2.34.1