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 2B2D5C369A2 for ; Thu, 10 Apr 2025 08:16:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34C986B02F0; Thu, 10 Apr 2025 04:16:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D02E6B02F1; Thu, 10 Apr 2025 04:16:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 14F426B02F2; Thu, 10 Apr 2025 04:16:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E96DA6B02F0 for ; Thu, 10 Apr 2025 04:16:50 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1BBB58045D for ; Thu, 10 Apr 2025 08:16:51 +0000 (UTC) X-FDA: 83317428222.26.29DAA35 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf12.hostedemail.com (Postfix) with ESMTP id C5B6D40002 for ; Thu, 10 Apr 2025 08:16:48 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=UsXoFCUJ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=AiYQtma9; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=UsXoFCUJ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=AiYQtma9; spf=pass (imf12.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.130 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=1744273009; 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=BeO8trQ+ylG1pNIV4/iVJDVcKDxWDQzcb2h2bPQiHN0=; b=UVd4IrKeh2sDz/Yuefxp6QHIr/UhvXGl1noWTuHFpY9g4npzF1fJVQt9GMD9JOT+N4ddk9 4EFwqSaZzMwkGyeusHwQRenIBXG0ZOKlUe+XDJujBXU8RLu66mZT6deYn+CmiFrJmY8Sh/ q53jxOw9VVTvQq3gSLxcDUqUtPpKNCM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=UsXoFCUJ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=AiYQtma9; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=UsXoFCUJ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=AiYQtma9; spf=pass (imf12.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744273009; a=rsa-sha256; cv=none; b=Ma0/ekuyVTgHCNAjzxPUT6uGu4VbhzK8bSJmMVxDDrUHndBYQ5yQd/FlklAyDXwWY5T63l CFuV2pE4nN4AqVzPEVEv7iGfOBSpnHfOIwDrB3nmC40HaFPpNPRHPoAXDXXvJol717E4rR 0dbeJNBrU12JQpG1S1r+w14Cg0uircI= 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-out1.suse.de (Postfix) with ESMTPS id 0DE0B211B8; Thu, 10 Apr 2025 08:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1744273007; 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=BeO8trQ+ylG1pNIV4/iVJDVcKDxWDQzcb2h2bPQiHN0=; b=UsXoFCUJdEBgJe9iqNIpBEPaj8Wfl1EZV6rZowH6EuovmucVhEijKv17hjsgQgBr0fzNdH XfRt7qLL+6YJoiJdqn4FoktzquN4TDbmw8O/rgy/RIvzfvFgF/O/8sFVxFV8on+KDy3sMS i8x1uYQVfMyVAXrKKz+yt3q/FfA0hww= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1744273007; 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=BeO8trQ+ylG1pNIV4/iVJDVcKDxWDQzcb2h2bPQiHN0=; b=AiYQtma9bQGr4MpMUQco6qvKp3RDiDCKYI/n0Om0gt5uAWEZk81x/I7xWpE3cbP+6oS+ci f8+GKUTUMJfMILDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1744273007; 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=BeO8trQ+ylG1pNIV4/iVJDVcKDxWDQzcb2h2bPQiHN0=; b=UsXoFCUJdEBgJe9iqNIpBEPaj8Wfl1EZV6rZowH6EuovmucVhEijKv17hjsgQgBr0fzNdH XfRt7qLL+6YJoiJdqn4FoktzquN4TDbmw8O/rgy/RIvzfvFgF/O/8sFVxFV8on+KDy3sMS i8x1uYQVfMyVAXrKKz+yt3q/FfA0hww= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1744273007; 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=BeO8trQ+ylG1pNIV4/iVJDVcKDxWDQzcb2h2bPQiHN0=; b=AiYQtma9bQGr4MpMUQco6qvKp3RDiDCKYI/n0Om0gt5uAWEZk81x/I7xWpE3cbP+6oS+ci f8+GKUTUMJfMILDw== 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 ECC68132D8; Thu, 10 Apr 2025 08:16:46 +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 N1NmOW5+92elBgAAD6G6ig (envelope-from ); Thu, 10 Apr 2025 08:16:46 +0000 Message-ID: Date: Thu, 10 Apr 2025 10:16:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] mm: page_alloc: speed up fallbacks in rmqueue_bulk() Content-Language: en-US To: Brendan Jackman , Johannes Weiner Cc: Andrew Morton , Mel Gorman , Carlos Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel test robot , stable@vger.kernel.org References: <20250407180154.63348-1-hannes@cmpxchg.org> <20250408185009.GF816@cmpxchg.org> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Action: no action X-Rspamd-Queue-Id: C5B6D40002 X-Rspamd-Server: rspam05 X-Rspam-User: X-Stat-Signature: wadk6wu3kxui99raz5b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182L8YaQ/RoiXUHM9A3R50TMwrdKQNl0zLL+jrn4k0fmYJei8troq+zvQaMj/OD3bzTlhDN83MNlhZe6he/uNW5a1RXbGhEqY4/Y7WZ4NTvwJe7FDoVOBOo0t/igyyOCEsXMFX2LQGdcXr/7HWz8Zp6ZEHsns1vYutvIe52y9qzk8vD9QpCv5Mb6jUhe2vcEXjM1Pa3IEXdVXeUwxr357N7toPIWRmEND7yK4YasBZAOndBq/Dx3Tn+U8UK3fw2qif2ROrd8B+0X3EO1TUBoRNEsyg8QU54suNEDwFT05TEEoeln4cD+MEk 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 4/9/25 19:30, Brendan Jackman wrote: > > From 8ff20dbb52770d082e182482d2b47e521de028d1 Mon Sep 17 00:00:00 2001 > From: Brendan Jackman > Date: Wed, 9 Apr 2025 17:22:14 +000 > Subject: [PATCH] page_alloc: speed up fallbacks in rmqueue_bulk() - comment updates > > Tidy up some terminology and redistribute commentary. > Signed-off-by: Brendan Jackman LGTM (assuming folding) > --- > mm/page_alloc.c | 22 +++++++++------------- > 1 file changed, 9 insertions(+), 13 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index dfb2b3f508af4..220bd0bcc38c3 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -2183,21 +2183,13 @@ try_to_claim_block(struct zone *zone, struct page *page, > } > > /* > - * Try finding a free buddy page on the fallback list. > - * > - * This will attempt to claim a whole pageblock for the requested type > - * to ensure grouping of such requests in the future. > - * > - * If a whole block cannot be claimed, steal an individual page, regressing to > - * __rmqueue_smallest() logic to at least break up as little contiguity as > - * possible. > + * Try to allocate from some fallback migratetype by claiming the entire block, > + * i.e. converting it to the allocation's start migratetype. > * > * The use of signed ints for order and current_order is a deliberate > * deviation from the rest of this file, to make the for loop > * condition simpler. > */ > - > -/* Try to claim a whole foreign block, take a page, expand the remainder */ > static __always_inline struct page * > __rmqueue_claim(struct zone *zone, int order, int start_migratetype, > unsigned int alloc_flags) > @@ -2247,7 +2239,10 @@ __rmqueue_claim(struct zone *zone, int order, int start_migratetype, > return NULL; > } > > -/* Try to steal a single page from a foreign block */ > +/* > + * Try to steal a single page from some fallback migratetype. Leave the rest of > + * the block as its current migratetype, potentially causing fragmentation. > + */ > static __always_inline struct page * > __rmqueue_steal(struct zone *zone, int order, int start_migratetype) > { > @@ -2307,7 +2302,8 @@ __rmqueue(struct zone *zone, unsigned int order, int migratetype, > } > > /* > - * Try the different freelists, native then foreign. > + * First try the freelists of the requested migratetype, then try > + * fallbacks modes with increasing levels of fragmentation risk. > * > * The fallback logic is expensive and rmqueue_bulk() calls in > * a loop with the zone->lock held, meaning the freelists are > @@ -2332,7 +2328,7 @@ __rmqueue(struct zone *zone, unsigned int order, int migratetype, > case RMQUEUE_CLAIM: > page = __rmqueue_claim(zone, order, migratetype, alloc_flags); > if (page) { > - /* Replenished native freelist, back to normal mode */ > + /* Replenished preferred freelist, back to normal mode. */ > *mode = RMQUEUE_NORMAL; > return page; > } > > base-commit: aa42382db4e2a4ed1f4ba97ffc50e2ce45accb0c