From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx1-f53.google.com (mail-yx1-f53.google.com [74.125.224.53]) (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 2197230DEDD for ; Wed, 17 Dec 2025 14:59:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765983581; cv=none; b=BPOCtnYfpOodL1Xq6B/hcNWDp4sBnZyKOpWb9T6sMZMNksq8fZRkNYQU2ivBKyyWqlxB4L0qClIDI0mKC4NhwSoBZI1m0KtEwrUvVZM42Y8f7wmYeBfEo1qlOPBB9Wn1BDR2H8zQsQYDVpqdJWfvwMyqslLJMuUZDX4wXREdzdU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765983581; c=relaxed/simple; bh=rfWfHtC3JTS7A4gW7f9rBqg+CQKkwIht4nxWOS0XmkE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=guk+EE7LI64UhGZ0FNBmmtaqhm6DJubGvRMFvMFBFZFUC6I1U37cEioc6moIXyXZ8QZnf3QoVzD6/DBSPjFG/MZICpCCeaC1CozIEG4zvFAkM1G7k8uz4R8rEQqEOQYQCS4TWrUeRdPE+QsTvVZ3zPi0h0X4meWPr4a3GoHvkyQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=i8dlFA7J; arc=none smtp.client-ip=74.125.224.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="i8dlFA7J" Received: by mail-yx1-f53.google.com with SMTP id 956f58d0204a3-6420c08f886so7004725d50.3 for ; Wed, 17 Dec 2025 06:59:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765983579; x=1766588379; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=om7fWDlG7JRBAVM8v+UjRYiuB71tqRQ7mO9GKgWPBsw=; b=i8dlFA7JoSFUz5wy27nbNFAlUO4p8/uqTJgY2TPpIiEFHFP+lB+lllksQJUIGLLHMt UG16rB9vAKY44W4p9kGlMAfMwAlpK5QKGX7vGy5FD2ltkOpMxpB6GwQplzlQ2IX9uoXI wwkFBjMAHV8x6R3qRUlQgkbJkJu+JoK1nCWWLCy1/CVjFUZ1yVm+8I6JAJ/t17kzKPQz sA4jgB/YTLYUoyQ9LxSYPqpaIuxv+NrVhp2cEeXJgR5kipLaLpv2SEEziKkF94orb8YZ 6VCGb1RkvPNta8qF8/ENyjKskEulkNoHNYVmNHjKahNJESA+8hYhY0l74/T18I+ivHLm VY4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765983579; x=1766588379; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=om7fWDlG7JRBAVM8v+UjRYiuB71tqRQ7mO9GKgWPBsw=; b=nuxG2wfBskDDhoLAvimH5YGwAocuZE9qipWwmpDJTgIOm1JvjIbX0deUxnU5HRNbwk x4/BKGLNNeF141ak+SGqnw4K0a9MOD105zv/yNsPk4v4HtGu1fERb7LH97MtbgMKt7gd TN0xRn2CHsscJ1IuZx1glLw2zLX3O6rRNNpE3x8+uHkGmwMj48NiGRFehPfgf05+K6HL 7WS0Ycdca7bLWkBIPjjrzyO2zuIAzfCNdhMiBJJ6s+ezn1R/x/OROR47XDJwT+17RQlH Vin6sDvLSSGLD9FaBfRLh8ygLVcj9N2vLC+HlB9+RtIWLucsmnJzAElSkedhElW41h7P WgSw== X-Forwarded-Encrypted: i=1; AJvYcCUKnXGOZO76rj0+C5kRhydrtoIlCM0tzfhel8t8bH5TylkO4HwrD0+CZ98ImiaBIoLWH1G2v0wIoO9rz5g=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6gs3geyNeMYGzfAAESlFLZym2jhJ4P6pJWLW4r4SVLuipvTv6 T/vJiShDLwW+dApstP0ZzSD1GjlmKp37IemUUk4WPgqEnSPzjPitbYfJ X-Gm-Gg: AY/fxX4XGp3oWDx+Ndj62oStbbSfRtMPBCCTFPECuXmweMtJHHlGuw+6yQJ9mC6xq8Z 1NeleI03lX+pOazdLgdDXwIpB2r9HXmxS9Gw+jGNtSJk0+r1uDIlWYowMCjdRVzboBVeCWcGJ+P ZCrog/7M17PIlsRmIbMxZvAEeAfvVAzhmW1JFrb8V12dwcBSWOoNFqMkOXXi5JG4abBj4uASUJb XlUkSRDGIXi48h+WPagzKyxqVq2X9oK8N9c631TqApo9Y00hW46ugnj5ZYe2tRLBf8y6+v+C3Am sHMZtezp+ejpHcmcMS6eUEobxM7qkZJK5dRxnn1qVEX/no2hXQCU//pSXVF81yS6C+Edob7WLym z1Y86iVoQHG/RYLV1CCUZcWh58oLllYkb/my1NOrc1CRYGvlvAjgoauCfIr0Pa3UDMGhyWNfzxr 63QqTc2FM65OsN7lGXJidlSw== X-Google-Smtp-Source: AGHT+IFlW+GTBKHXgTr0MLAOSDznbq0ZzlTE4iKHk+uu4fdhX3OuHaBTkZENLnMVgzyJRtEPxq44XA== X-Received: by 2002:a53:dd09:0:b0:63f:a79a:7690 with SMTP id 956f58d0204a3-645555eb8demr10489093d50.39.1765983579022; Wed, 17 Dec 2025 06:59:39 -0800 (PST) Received: from localhost ([2a03:2880:25ff:4f::]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64477db6476sm9075272d50.20.2025.12.17.06.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 06:59:38 -0800 (PST) From: Joshua Hahn To: Vlastimil Babka Cc: Andrew Morton , Daniel Palmer , Guenter Roeck , Brendan Jackman , Johannes Weiner , Michal Hocko , Suren Baghdasaryan , Zi Yan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Matthew Wilcox Subject: Re: [PATCH] mm/page_alloc: restore 0-handling to zone_set_pageset_high_and_batch Date: Wed, 17 Dec 2025 06:59:26 -0800 Message-ID: <20251217145936.4094990-1-joshua.hahnjy@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <17c45b15-326d-4b4a-b3f3-745002b81d5f@suse.cz> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Wed, 17 Dec 2025 14:19:47 +0100 Vlastimil Babka wrote: > On 12/17/25 14:02, Joshua Hahn wrote: > > On Wed, 17 Dec 2025 12:23:58 +0100 Vlastimil Babka wrote: > > > >> On 12/17/25 12:12, Vlastimil Babka wrote: > >> > On 12/17/25 07:05, Joshua Hahn wrote: > >> >> Commit 2783088ef24e ("mm/page_alloc: prevent reporting pcp->batch = 0") > >> >> moved the error handling (0-handling) of zone_batchsize from its > >> >> callers to inside the function. However, the commit left out the error > >> >> handling for the NOMMU case, leading to deadlocks on NOMMU systems. > >> >> > >> >> Since in the NOMMU case the reported-to-user batchsize should still be 0, > >> > > >> > Should it? The value is effectively set to 1 despite what zone_batchsize() > >> > returns, because of that adjustment this patch reinstates. Also does anyone > >> > care, really? > >> > > >> >> we would only like the error handling to exist in the callsites that > >> >> set the internal value for the zone (i.e. zone_set_pageset_high_and_batch). > >> >> > >> >> Restore max(1, zone_batchsize(zone)) to the callsite to prevent errors > >> >> on NOMMU systems. > >> > > >> > I would rather make zone_batchsize() for !CONFIG_MMU return 1 instead of 0. > >> > >> Ah looks like you considered it too, initially: > >> https://lore.kernel.org/all/20251211225947.822866-1-joshua.hahnjy@gmail.com/ > >> > >> It makes more sense to me than doing effectively two fixups in the MMU case. > > > > Hi Vlastimil, > > > > Thank you for your review as always. > > > > Yes, I had also considered returning 1 for the !MMU case, since I think it > > would make it a lot simpler as well (It would also make my original patch > > function as intended). > > > > However, I was unsure if changing this user-facing behavior for one line of > > simplification would be worth it. I am not a NOMMU user, so I have very > > little experience here, but I imagine that there is someone out there who > > looks at zone_batchsize() returning 0 for NOMMU and interpreting it as > > "there is no batching" as opposed to "there is batching, and it processes > > 1 page at a time" (which, actually isn't even true anyways because of the > > bitshift). Maybe an option is to just make batchsize not visible > > in the NOMMU case in addition to always returning 1 to avoid confusion. > > > > Anyways, back to your original question of "does anyone care". . . > > > > I am not sure : -) > > It's a pr_debug(), it's not even being printed by default, nothing can > possibly break by changing 0 to 1 there. So I really wouldn't overthink this... > > > For me, both solutions work, and in fact I prefer the original solution of > > always reurning 1 for !NOMMU. Maybe some NOMMU users like Daniel and Guenter > > can comment on whether this change really matters? > > I would be surprised if they were aware of that pr_debug() in the first place :) You are right : -) I do think I was overthinking it. Happy to send a v2 that just returns 1 for NOMMU. I'll wait for a day or so to see if anyone has any strong objections to this. Thank you again! Have a great day! Joshua