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 E06C3C021BE for ; Thu, 27 Feb 2025 10:13:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1270D6B007B; Thu, 27 Feb 2025 05:13:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D6676B0088; Thu, 27 Feb 2025 05:13:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDF726B0089; Thu, 27 Feb 2025 05:13:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id CDEC26B007B for ; Thu, 27 Feb 2025 05:13:29 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 560F2120CF6 for ; Thu, 27 Feb 2025 10:13:29 +0000 (UTC) X-FDA: 83165312538.14.B713145 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by imf25.hostedemail.com (Postfix) with ESMTP id 6B693A0014 for ; Thu, 27 Feb 2025 10:13:27 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=yKJ4o3R1; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf25.hostedemail.com: domain of jackmanb@google.com designates 209.85.128.50 as permitted sender) smtp.mailfrom=jackmanb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740651207; a=rsa-sha256; cv=none; b=7pE3tq9qe2MGCSSSjAZcbsrPmLbHwSJUDcu+J16Knvg3Dyyzn086qa5vB2Lb/87UVEwItQ 3U9lWhnDxLmzGYRcmQ4V3C+2QFj2iBISlnOp08p+xNtJamFF7ueogNeZk5KL82bIgNHZUS 00jYG8UAdMQOMMoPM6HNoH7lG8YifNw= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=yKJ4o3R1; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf25.hostedemail.com: domain of jackmanb@google.com designates 209.85.128.50 as permitted sender) smtp.mailfrom=jackmanb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740651207; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OVuAlhVfTzJKU2iFaYa/qiEZ8SOesoanaitSjfgOFaM=; b=OBdYoOcU9Ry3qvzAScR+xoNuDjuHVSh0/ppvlOyjkQtZG8l/19GQJrrSsBujx3Be2tVJa4 WZfJQtc0ShfvBashCGjIlbAGsOgYAbhPI/WF8l8ILBStddNT7qaU0FTI8OnJsGxr2BU9Wy S75UjXcGhxdePOnxZL0xbgaGu+GUMRo= Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-438d9c391fcso44735e9.0 for ; Thu, 27 Feb 2025 02:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1740651206; x=1741256006; darn=kvack.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=OVuAlhVfTzJKU2iFaYa/qiEZ8SOesoanaitSjfgOFaM=; b=yKJ4o3R12aVLS0iUMoOO92Prjt3vbsZCQqyQMu4/GljTivUOuJayT8daKorkaF/dJ2 2qo8+OTTEa1EeECvFWyep1Ep7nZ6TwsflzAMWHWDUthcMA6yIOrMwJYeT9cRytT5vhvK pNpPTgS2cmZoqebXBWpWEe1klBOVNQqd1+1a091Y2u+FAEIShSPwUTDNWuEJFSOkLV6j UX6t/8rKkRtaut8mr8MJLzfHfU/p0aVLAqVL/Xf9+CTP0tJitzWn1c647Vocl2IN9Yh5 NXIgx1ypHOz79jNoAcyfFsgs1hriKr0fUZGMKnaCAPtWZWysh7qtdz7l1U+LTeXHbhxw iq8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740651206; x=1741256006; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OVuAlhVfTzJKU2iFaYa/qiEZ8SOesoanaitSjfgOFaM=; b=Obj7AZntrs/f4QlDH3+1VZViRex4iMSIyKvID0aL/7/2+GpxrwUOUdcDmSGYE66FNF igO7sCfjCoWP8gxw6YkWgAfty2yY54LG17QlxIkklL6nb+4hy49VNoovEbh1TPrhdsPk FckGBfF4Zp4rlRFhhgKCkrXWBNPcex1UAMIioFEGZQ8AYgkZRXX8jjRfZf+jd5EpAwTX 3Sn6tth95zpe/b4AN9qMrbU6c1tN/v9YeQE+XEG4dGYhuMuyOkDg1XigEd4ri0i3HWFy U2ZU6R/EzZs2lB1m4549qZSCjBDz/Hboh6G3yb4spsHQIkoS3llCm07T/SSgjuhu5KlV s+0w== X-Forwarded-Encrypted: i=1; AJvYcCUQf25i/Os3hnJCvA7E8hG+P0Y8EUSm5DPVhHyztdV+ayoCV6n3jNlBBZ+dg9VHK/Uaumg7s3OW+Q==@kvack.org X-Gm-Message-State: AOJu0Yz3B2MlsR/tcqVVZgUETgb5kfYyd4uidSKlHx2SpdKG+D0LBYHX UATMNC8UIzyz0fZ+Fnyu53l8DflBbyeEMKQmYFBcsrlZjMB5PrXOvWlIgc0rSg== X-Gm-Gg: ASbGncvTq4GS/hKahoxes0Of4nIRRHZqH57oNe173sW6JSyT5Ad6xQKcNYHwpIpKgPx jXHx4VaNxk2dcSIR9rmO0AWYCenLjTz7/J4yydVlByjLe+b+4xZTpXFyFW70loosbjFvOdgyGBo i+s2RTIrhtPJloXzmrJTWC2ccWGoelEkHN0PJWsUiUchlRSTxXKIW0TxpRuh7JBIj5gGYd51yqf k365FZxhv3ZMX+YnzsGvsAlFTjU0pCpB6OclWJWX40AVJHdb3576FhUdsFJ597SS4xneeQoFmhd iQ062C+op+iergYUqpOs8CW8FlISRhmQ2vk/itdGo1NzknhWmrKISXWTyixYRA== X-Google-Smtp-Source: AGHT+IFb7iEscj4MTGrmiEQToaJSvpkhlzspgfd6Jz4xpwx75rGqasMK8FmypS0Tw2qVP0knB/rUbg== X-Received: by 2002:a05:600c:8a8:b0:439:8c80:6b0c with SMTP id 5b1f17b1804b1-43b38674dc0mr879725e9.0.1740651205681; Thu, 27 Feb 2025 02:13:25 -0800 (PST) Received: from google.com (44.232.78.34.bc.googleusercontent.com. [34.78.232.44]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-390e47a6a6csm1565808f8f.30.2025.02.27.02.13.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 02:13:24 -0800 (PST) Date: Thu, 27 Feb 2025 10:13:19 +0000 From: Brendan Jackman To: Vlastimil Babka Cc: Andrew Morton , Mel Gorman , Michal Hocko , Johannes Weiner , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed Subject: Re: [PATCH v3 1/2] mm/page_alloc: Clarify terminology in migratetype fallback code Message-ID: References: <20250225-clarify-steal-v3-0-f2550ead0139@google.com> <20250225-clarify-steal-v3-1-f2550ead0139@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 6B693A0014 X-Stat-Signature: wmzpsm4cr35776rxcqiwnxm6ufoq8a77 X-Rspam-User: X-HE-Tag: 1740651207-899610 X-HE-Meta: U2FsdGVkX19YhFFKvj6qGKUVb/ndlrcKvgTQbCr9i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OZJWzRv7uB66Wagp8V6I3GcSdGGphQIHddbm3WrhehuVw0vbgEIxCdZjroxax5bHVeUzH8+YBolFRsGoQrYxx/RaqTRpcHCOhnqECZecsTWQijQOLADlEvyIhMaV3TRyOsrtkaook80rhABzA9N/ga36f2Qrn8qT7pQnC/dyLEqUEoG3nKOo215J44C1QXQ9kGofOucKzZfaP+BrbUqng+wT9TVooEs7TKqw318/b87wEbtVN+4+eFeyLEI5z9O5PKtJWw== 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 Wed, Feb 26, 2025 at 04:08:09PM +0100, Vlastimil Babka wrote: > On 2/25/25 4:29 PM, Brendan Jackman wrote: > > /* > > * When we are falling back to another migratetype during allocation, try to > > - * steal extra free pages from the same pageblocks to satisfy further > > - * allocations, instead of polluting multiple pageblocks. > > + * claim entire blocks to satisfy further allocations, instead of polluting > > + * multiple pageblocks. > > * > > - * If we are stealing a relatively large buddy page, it is likely there will > > - * be more free pages in the pageblock, so try to steal them all. For > > - * reclaimable and unmovable allocations, we steal regardless of page size, > > - * as fragmentation caused by those allocations polluting movable pageblocks > > - * is worse than movable allocations stealing from unmovable and reclaimable > > - * pageblocks. > > + * If we are stealing a relatively large buddy page, it is likely there will be > > + * more free pages in the pageblock, so try to claim the whole block. For > > + * reclaimable and unmovable allocations, we claim the whole block regardless of > > It's also "try to claim" here as it may still fail due to not enough > free/compatible pages even for those migratetypes. Yeah thanks, I seems worthwhile to be precise about this. > Maybe the question > (out of scope of the patch) if they should get a lower threshold than > half. Before migratetype hygiene, the "we steal regardless" meant that > we really would steal all free pages even if not claiming the pageblock. I wonder if there's some benefit to deciding when to claim blocks also based on the count of blocks per type or something? Like, if we're under memory pressure so all the freelists are empty, but there are already a bunch of unmovable blocks (that currently have movable pages in them), there's not much point in claiming a block, instead we'd prefer to reclaim/migrate those movable pages? > > + * page size, as fragmentation caused by those allocations polluting movable > > + * pageblocks is worse than movable allocations stealing from unmovable and > > + * reclaimable pageblocks. > > */ > > -static bool can_steal_fallback(unsigned int order, int start_mt) > > +static bool should_claim_block(unsigned int order, int start_mt) > > So technically it's should_try_claim_block() if we want to be precise > (but longer). Yep, that seems worth it (especially given the function is effectively just an internal block of find_suitable_fallback()). > > { > > /* > > * Leaving this order check is intended, although there is > > * relaxed order check in next check. The reason is that > > - * we can actually steal whole pageblock if this condition met, > > + * we can actually claim the whole pageblock if this condition met, > > try claiming But I think in this case we really do claim unconditionally.