From mboxrd@z Thu Jan 1 00:00:00 1970 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 9D644C021B8 for ; Wed, 26 Feb 2025 12:59:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 26FBA280007; Wed, 26 Feb 2025 07:59:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 21F1B280001; Wed, 26 Feb 2025 07:59:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C01A280007; Wed, 26 Feb 2025 07:59:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E3A2E280001 for ; Wed, 26 Feb 2025 07:59:25 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3CAED1CA01A for ; Wed, 26 Feb 2025 12:59:18 +0000 (UTC) X-FDA: 83162101596.16.7C98E98 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf27.hostedemail.com (Postfix) with ESMTP id E2F5040009 for ; Wed, 26 Feb 2025 12:59:14 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=ibliuOcR; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=z8XiIOFG; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="cC6D/ywA"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=sq0lWdLw; spf=pass (imf27.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740574755; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pKw+8x+cz6leM3qsRegi9CncmE3h4CpX5MOqMzVfoyA=; b=PmD4525+xxEAQ9zRP6Fu5Qy37JCeWayiJ/n9qqANK9id21UfF2O++5aptSw9u3upsLWw4W vBEENlGtAUXSoEC5WQw/RDv6ALesfgRP112RQzLM1eyxlkDw8uAOo2kzrpsNwD8Y/N2WME Jbf6oGlvYQ6GnpmvvuvNavMvBLRE+aU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=ibliuOcR; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=z8XiIOFG; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="cC6D/ywA"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=sq0lWdLw; spf=pass (imf27.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740574755; a=rsa-sha256; cv=none; b=AgxU1NmrCQAFXGm99uGkFlmXC94A+MQwV0S2fp/431Uynw53zVa928ZJqJdaqYGBw+fWbZ yHWbMZO7FXm79nfJsRWBMAxFMyif+q9tUEPbL6gXYRJkR5NmbSiE4PAtJU2y1YSQ6fi8Uf 0AsVNaftysnhOfvGc2GxR2JAhAa4zTs= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3089F1F388; Wed, 26 Feb 2025 12:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1740574753; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pKw+8x+cz6leM3qsRegi9CncmE3h4CpX5MOqMzVfoyA=; b=ibliuOcRC+J7kZfR85K7mW1BXTdO8wUK0ygfZfx4qvW1vfzImBlBWOaBcQ3FhMh3Rngmnw UhLjDbPAl7LjQBNtPvxkRYvmSe4biImpFbSDdpxB++H13rOA65mFmlXxkJKyX0icdCgZtH nlVSQHoyDKSyuB6VQWeBdlC8d/H7wzY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1740574753; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pKw+8x+cz6leM3qsRegi9CncmE3h4CpX5MOqMzVfoyA=; b=z8XiIOFGm7yUPvzGAxF1ZTSptXkefyE+Ojc0Sj/QvK41o6aWkIS1KMF2TABYS70rJ6mA/w wJuk1BytxtGPp8Dw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1740574752; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pKw+8x+cz6leM3qsRegi9CncmE3h4CpX5MOqMzVfoyA=; b=cC6D/ywA/T5KQtu7ByZCYjzJ50YiWFaBJAUE7y+JiTaYXODBvtz+Ja7xu4aP6DXFmNRdDO Cq7bdeG/QSQcqZ8ek9Z3p08JUq7dMDtHHbQxkzGi5C1TTK8MQ/9GD3rJreZX2fogLtE14/ zGLKsQEyeKYsE5drT5iUjoh+3N6PKmc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1740574752; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pKw+8x+cz6leM3qsRegi9CncmE3h4CpX5MOqMzVfoyA=; b=sq0lWdLwiMUmW/Y0fPQ8uE+ThLIU5YXT0CYwRC2pdFWazsngAnKwVuOYLbvhnWo3HDplyv H7MQpXSJbFrIGjAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 21DF81377F; Wed, 26 Feb 2025 12:59:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 3Dz/ByAQv2fVJAAAD6G6ig (envelope-from ); Wed, 26 Feb 2025 12:59:12 +0000 Message-ID: Date: Wed, 26 Feb 2025 14:00:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Revert "mm/page_alloc.c: don't show protection in zone's ->lowmem_reserve[] for empty zone" To: Gabriel Krisman Bertazi , akpm@linux-foundation.org Cc: linux-mm@kvack.org, Michal Hocko , Mel Gorman , Baoquan He References: <20250226032258.234099-1-krisman@suse.de> From: Vlastimil Babka Content-Language: en-US In-Reply-To: <20250226032258.234099-1-krisman@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Action: no action X-Rspam-User: X-Rspamd-Queue-Id: E2F5040009 X-Stat-Signature: aysyzqy63wz9md66j95ihcz9hkwuy9xj X-Rspamd-Server: rspam03 X-HE-Tag: 1740574754-923374 X-H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fLPWEDcvGnVWfq0sdAxuduI5mQjBuemGpBLZ1uo9aJFtiXiC0qFehoXwYJ/LoxxhGQJ1CWk2/PPQFiaMN2VljhrR9XFxlFHt14HD/ZxljsxsmuvJsR3cC6JA12xe6tG+OHJl23jqdXmYINqCqhzK7SVM6nYm3qrrZr49KBPntAKyAjcX4fPoBtatif9qTGqpfmf1FNGrWly53AQDrlN5g6688dpxFrANwf3Q6OeQbh8GFLaEiLM2Fon0tYlxrW7bItJNGWRgReNw80aJvUxmIhZPLjyXlPWc/aMx3JkPOMV494qI9 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: On 2/26/25 4:22 AM, Gabriel Krisman Bertazi wrote: > Commit 96a5c186efff ("mm/page_alloc.c: don't show protection in zone's > ->lowmem_reserve[] for empty zone") removes the protection of lower > zones from allocations targeting memory-less high zones. This had an > unintended impact on the pattern of reclaims because it makes the > high-zone-targeted allocation more likely to succeed in lower zones, > which adds pressure to said zones. I.e, the following corresponding > checks in zone_watermark_ok/zone_watermark_fast are less likely to > trigger: > > if (free_pages <= min + z->lowmem_reserve[highest_zoneidx]) > return false; > > As a result, we are observing an increase in reclaim and kswapd scans, > due to the increased pressure. This was initially observed as increased > latency in filesystem operations when benchmarking with fio on a machine > with some memory-less zones, but it has since been associated with > increased contention in locks related to memory reclaim. By reverting > this patch, the original performance was recovered on that machine. > > The original commit was introduced as a clarification of the > /proc/zoneinfo output, so it doesn't seem there are usecases depending > on it, making the revert a simple solution. > > Cc: Michal Hocko > Cc: Mel Gorman > Cc: Vlastimil Babka > Cc: Baoquan He > Fixes: 96a5c186efff ("mm/page_alloc.c: don't show protection in zone's ->lowmem_reserve[] for empty zone") > Signed-off-by: Gabriel Krisman Bertazi Reviewed-by: Vlastimil Babka > --- > mm/page_alloc.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 579789600a3c..fe986e6de7a0 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -5849,11 +5849,10 @@ static void setup_per_zone_lowmem_reserve(void) > > for (j = i + 1; j < MAX_NR_ZONES; j++) { > struct zone *upper_zone = &pgdat->node_zones[j]; > - bool empty = !zone_managed_pages(upper_zone); > > managed_pages += zone_managed_pages(upper_zone); > > - if (clear || empty) > + if (clear) > zone->lowmem_reserve[j] = 0; > else > zone->lowmem_reserve[j] = managed_pages / ratio;