From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) (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 5E4AA34E25E for ; Wed, 17 Dec 2025 13:03:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765976608; cv=none; b=DSMXW/h89oSmmMKQu4BXSaZdhH/pGVxHUKIavjBxpdq62STv6/Umoq3uev0C8HBH82hZSivY6buey3ozclGqsnFVtznBYCOFIalquUNGTihtwuuFHy6Qq1lg6cMa4qDe5Hi0MyJe71f0uIbxHy7LMbnawpwWTRr2N9NPJbAcXDU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765976608; c=relaxed/simple; bh=s3GA1J08n511Rjjz5BTRhncY4avcVnML3HsbqZ3VzA8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XGWjugRtPkccagG0aB7cobBKFtRuIpPm2ZDRcCxqaQX1cNrPH+3ayfizhpZX7JweQ2BLKKjJPcCkm6QbQQmCM8B/aVxE2vYOhgYnVt/rzsA06CmabZE6kkQ3HAAaxXHrvUmkFzG5ZmK55DcFKFvLSJ0EYnfYS534mtKzLuwaemw= 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=Gkx35J9H; arc=none smtp.client-ip=209.85.128.171 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="Gkx35J9H" Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-787df0d729dso48447497b3.3 for ; Wed, 17 Dec 2025 05:03:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765976605; x=1766581405; 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=3OrcXKWdvuAE6N1CLZCeBV2HX5BbxYzxVYTn7sFPcwg=; b=Gkx35J9Hx8OKd2kdIoHJY3wUpdyrCFZlJJ+hhe3tzlAB+ftHR+vOctWZLafD2Xspys Z6xjWeGurBijl5htrT8Zz6uiAWYIWRrG1xKypUjmlDLSob3FkRUkJybXpPyYyHS4mMQo atrEDz5F+DokDpBPAX97vIiLA4BnOgCAuSigmBPezjF6Zg3PFE1eqzMLb1EBqZtBBAM6 vhfEbzaB7enEyXSqO7D/o6cKbuPDaxQr78V2WvN5DVJ1YVLq49ljgvN1rJlzbaAB+Kjj e3VNC9Dpn/0eUR6JP6ResgN7m7rJg2zWixFEOYin1a/r5ubFVaJv2ycI1MRuPsRuABPO soYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765976605; x=1766581405; 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=3OrcXKWdvuAE6N1CLZCeBV2HX5BbxYzxVYTn7sFPcwg=; b=cIVbgI71zlVazmjvNNqgSC7ZQWMTafjzYPVz0Iysc2QGIF8mBkZRywBJdhGtmox7/5 +6NsKu1K7GMYxS2PRMNUAKXLIdFBkNU38lSSLViYggUiIL0Mkutftu5jPSVTO0UYYG7H KeSUVZpGbmskaO+jAP4MIWpHaPltr84lN2rpYt2ImQBYXxS1juNPAkopjW6HAs/kKZbs EryNu2fus3USWL8sPkHkYoHmcGDsxVya8pzttUFXj0n9Yuy2BWiC4SCaCyBKEwcABRig /EhEbd7RhiMabzSqAAuXOsiw9jFQ9JvaHfDYGE+afFnQNvB3cRGVYarOF6R3k1E/foez ORcg== X-Forwarded-Encrypted: i=1; AJvYcCVCzWTQLXcbBv0SidAYmT2rNl5cr3wxzheeay2cj3biO+vxTfJDiRrzIqKafy4U/6JL0qF5Ctcs9+U9bW0=@vger.kernel.org X-Gm-Message-State: AOJu0YzLbqq0AEIXh5ahNheCCdiSvVTp5Wh6PZNR1xJDIlQP39f2efa7 MyJpd8q6kZy1e7VJiFpkzao8oJLSBNVdVABj5lFqYLH86J241QFiRLQ/ X-Gm-Gg: AY/fxX4HJi/YtXOh9gGdFqIpaLlzQt6MzaykNZE9q6tqAYN+HsnixDPrQ76MU9ahtyX vNoWEDw3r0s3FIuxUvDYxaUbjYJ5VSM5yo67X8rJPvITlYlrjyalmBhyPlk3Vvg03Pve4HzUMzq blMuu5Ea3LNCaD7hln0kGX8xJdabN8tBHeC6/bz0KA+nWbCa6uNdMwUdHzCOjeGW5N+/Aih97YY wv0v1VQMoOLaxfBOeejiDtFoczK+314S6ZK5gPKApwpSWW9OfcCqjjZw+QT0acrhg/sTPdKD7K+ D9SMqu0U+wEhzyOlqfNQyv6qiAgOyC3SmfXB2jeByYpUysfWKsja717SyF/zEawoWH7uj6V6uoE bYtl6A6SGWfCyCMrq0aSh86GGhBAmm5SFsMSnOLVv/LWV/93b0dvtun5qtkBztEksd76wnEnCTc bLJwGWG0/12wCdKhyJL1AXhg== X-Google-Smtp-Source: AGHT+IFFpd8MqeMm8cAUKBinfGXtHNbZPWn3XFitHYBMLyDx8pC7+Lc8XbhhZbINQA9DF5spw70kFw== X-Received: by 2002:a05:690c:f82:b0:78c:2c2a:fc3e with SMTP id 00721157ae682-78e66d1ed33mr149339407b3.21.1765976604948; Wed, 17 Dec 2025 05:03:24 -0800 (PST) Received: from localhost ([2a03:2880:25ff:51::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-78e748d26b8sm49501337b3.11.2025.12.17.05.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 05:03:24 -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 05:02:52 -0800 Message-ID: <20251217130322.3350377-1-joshua.hahnjy@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <1c94600d-47eb-40b6-8c7e-fb2cc39e1e4b@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 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 : -) 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? Thank you again for your review and follow-up. I hope you have a great day! Joshua