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 22B0DC4321E for ; Mon, 5 Dec 2022 05:17:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14B8C8E0002; Mon, 5 Dec 2022 00:17:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0FB1E8E0001; Mon, 5 Dec 2022 00:17:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDDA08E0002; Mon, 5 Dec 2022 00:17:23 -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 DBC348E0001 for ; Mon, 5 Dec 2022 00:17:23 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B07501C3A36 for ; Mon, 5 Dec 2022 05:17:23 +0000 (UTC) X-FDA: 80207094366.20.9DF5664 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf15.hostedemail.com (Postfix) with ESMTP id F01D4A0006 for ; Mon, 5 Dec 2022 05:17:21 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=bxfN2QEf; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=oxYT2yGr; spf=pass (imf15.hostedemail.com: domain of neilb@suse.de designates 195.135.220.29 as permitted sender) smtp.mailfrom=neilb@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670217442; a=rsa-sha256; cv=none; b=UsRYyisyO6rAmaCIEditmlnc3LhKE5/Cjr+vLGh/aKjUGPkDbxRSwQKYoB+x4xAtwfMU4G SP+wO+rRwd5hgk+LhSDFlvJPFRbFVz85snN2xfo+HoN5G/gI65W8CwBMR82Pz64ioN27xz W0Pre3iNase3Suuusm4yCiIpkBYCXRw= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=bxfN2QEf; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=oxYT2yGr; spf=pass (imf15.hostedemail.com: domain of neilb@suse.de designates 195.135.220.29 as permitted sender) smtp.mailfrom=neilb@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670217442; 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=hkNfxgC2YLQFMqZWOCiI4CofWeHNYOS5cHbeZCuOgxA=; b=UirqPtfbPhf5CwZRNDD4s0bL9mtHjFvo2wN0XEu74cx2SLHZcsDnC+wmhx/PgtwXOoS2bW TU9sFNPW1eMstdMTph9ZoFGWiDQjGU6BY/Wy44Y41lxbxo00OXmmTIvsgQiPt9MQ/e9hwW rmVmIqryjOW6WpWjrpOB8xZePtxpn6o= Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8EE761FE23; Mon, 5 Dec 2022 05:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1670217439; 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=hkNfxgC2YLQFMqZWOCiI4CofWeHNYOS5cHbeZCuOgxA=; b=bxfN2QEfHcDB6jcvA6Wx/2dTWKWUlUA99Yw2I9nfIkI7mRWEcBdgORsndIgqnnhAs56kji 4zphG/heMjBtYcr/sZ/cnEsw68x2mD/+KYtMJtvuHRnZKUPsg6dj/nRs/fQJcxCTIHzCGZ kWeIOi9qLo9mhPEN4ZlA//hrulgDjfY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1670217439; 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=hkNfxgC2YLQFMqZWOCiI4CofWeHNYOS5cHbeZCuOgxA=; b=oxYT2yGr53qaMbC4k+gOaMLS8YL+8v1TTxRUugf7fKtuzlV8Ng+dby43xVhmTvcFzFAyYU SKsGIm5EAfLFRRCQ== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id BF90D13411; Mon, 5 Dec 2022 05:17:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id TYJxHNx+jWO4awAAGKfGzw (envelope-from ); Mon, 05 Dec 2022 05:17:16 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Mel Gorman" Cc: "Linux-MM" , "Andrew Morton" , "Michal Hocko" , "Thierry Reding" , "Matthew Wilcox" , "Vlastimil Babka" , "LKML" , "Mel Gorman" Subject: Re: [PATCH 3/6] mm/page_alloc: Explicitly record high-order atomic allocations in alloc_flags In-reply-to: <20221129151701.23261-4-mgorman@techsingularity.net> References: <20221129151701.23261-1-mgorman@techsingularity.net>, <20221129151701.23261-4-mgorman@techsingularity.net> Date: Mon, 05 Dec 2022 16:17:12 +1100 Message-id: <167021743246.8267.14900064704332224542@noble.neil.brown.name> X-Rspam-User: X-Spamd-Result: default: False [-4.35 / 9.00]; BAYES_HAM(-5.95)[99.88%]; SUSPICIOUS_RECIPS(1.50)[]; SUBJECT_HAS_UNDERSCORES(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[suse.de,none]; R_SPF_ALLOW(-0.20)[+ip4:195.135.220.0/27]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_SEVEN(0.00)[9]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; ARC_NA(0.00)[]; TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; TAGGED_RCPT(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: F01D4A0006 X-Rspamd-Server: rspam01 X-Stat-Signature: 3khsk76nnxx9bfuu7n7qdntcuu8fzyg9 X-HE-Tag: 1670217441-465899 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: Hi Mel, thanks a lot for doing this! I tried reviewing it but "HIGHATOMIC" is new to me and I quickly got lost :-( Maybe one day I'll work it out - now that several names are more meaningful, it will likely be easier. Thanks, NeilBrown On Wed, 30 Nov 2022, Mel Gorman wrote: > A high-order ALLOC_HARDER allocation is assumed to be atomic. While that > is accurate, it changes later in the series. In preparation, explicitly > record high-order atomic allocations in gfp_to_alloc_flags(). >=20 > Signed-off-by: Mel Gorman > --- > mm/internal.h | 1 + > mm/page_alloc.c | 19 +++++++++++++------ > 2 files changed, 14 insertions(+), 6 deletions(-) >=20 > diff --git a/mm/internal.h b/mm/internal.h > index d503e57a57a1..9a9d9b5ee87f 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -754,6 +754,7 @@ unsigned int reclaim_clean_pages_from_list(struct zone = *zone, > #else > #define ALLOC_NOFRAGMENT 0x0 > #endif > +#define ALLOC_HIGHATOMIC 0x200 /* Allows access to MIGRATE_HIGHATOMIC */ > #define ALLOC_KSWAPD 0x800 /* allow waking of kswapd, __GFP_KSWAPD_RECLAI= M set */ > =20 > enum ttu_flags; > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index da746e9eb2cf..e2b65767dda0 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -3710,7 +3710,7 @@ struct page *rmqueue_buddy(struct zone *preferred_zon= e, struct zone *zone, > * reserved for high-order atomic allocation, so order-0 > * request should skip it. > */ > - if (order > 0 && alloc_flags & ALLOC_HARDER) > + if (alloc_flags & ALLOC_HIGHATOMIC) > page =3D __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC); > if (!page) { > page =3D __rmqueue(zone, order, migratetype, alloc_flags); > @@ -4028,8 +4028,10 @@ bool __zone_watermark_ok(struct zone *z, unsigned in= t order, unsigned long mark, > return true; > } > #endif > - if (alloc_harder && !free_area_empty(area, MIGRATE_HIGHATOMIC)) > + if ((alloc_flags & ALLOC_HIGHATOMIC) && > + !free_area_empty(area, MIGRATE_HIGHATOMIC)) { > return true; > + } > } > return false; > } > @@ -4291,7 +4293,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int o= rder, int alloc_flags, > * If this is a high-order atomic allocation then check > * if the pageblock should be reserved for the future > */ > - if (unlikely(order && (alloc_flags & ALLOC_HARDER))) > + if (unlikely(alloc_flags & ALLOC_HIGHATOMIC)) > reserve_highatomic_pageblock(page, zone, order); > =20 > return page; > @@ -4818,7 +4820,7 @@ static void wake_all_kswapds(unsigned int order, gfp_= t gfp_mask, > } > =20 > static inline unsigned int > -gfp_to_alloc_flags(gfp_t gfp_mask) > +gfp_to_alloc_flags(gfp_t gfp_mask, unsigned int order) > { > unsigned int alloc_flags =3D ALLOC_WMARK_MIN | ALLOC_CPUSET; > =20 > @@ -4844,8 +4846,13 @@ gfp_to_alloc_flags(gfp_t gfp_mask) > * Not worth trying to allocate harder for __GFP_NOMEMALLOC even > * if it can't schedule. > */ > - if (!(gfp_mask & __GFP_NOMEMALLOC)) > + if (!(gfp_mask & __GFP_NOMEMALLOC)) { > alloc_flags |=3D ALLOC_HARDER; > + > + if (order > 0) > + alloc_flags |=3D ALLOC_HIGHATOMIC; > + } > + > /* > * Ignore cpuset mems for GFP_ATOMIC rather than fail, see the > * comment for __cpuset_node_allowed(). > @@ -5053,7 +5060,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int o= rder, > * kswapd needs to be woken up, and to avoid the cost of setting up > * alloc_flags precisely. So we do that now. > */ > - alloc_flags =3D gfp_to_alloc_flags(gfp_mask); > + alloc_flags =3D gfp_to_alloc_flags(gfp_mask, order); > =20 > /* > * We need to recalculate the starting point for the zonelist iterator > --=20 > 2.35.3 >=20 >=20