Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5423508rwb; Sun, 4 Dec 2022 21:35:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf4BaCKUDWb97zOw5BgY+sv5dtlEg715Yp4By5LQX5F9ljYg+rREOHlXQRDN1OMbvC9FE8Lq X-Received: by 2002:a17:902:db10:b0:189:5858:43c0 with SMTP id m16-20020a170902db1000b00189585843c0mr53814530plx.71.1670218531458; Sun, 04 Dec 2022 21:35:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670218531; cv=none; d=google.com; s=arc-20160816; b=XwNpCuihhlFXYKZ9T46dyFSL1NtbNCHlz6knJIhFx8xswBhiXevUASiaXLoh1qUmds bCWYQcFRC1Z3fnrIcrh70xEJ2eGl3PZ5Dmee/RX4EPETa7Dv0lreshuhcH76y8MP6k8X 4jzk6vfzvnR9V3SKdWnFPKl/ff+4Rc2MwzjS92x3coGSOegcRnJIcdWoM87djgWoRJum vu8jEfPUmB1Hy4KiMMoDs76tkxlMOM3res2bxd9ToVEQ/NYuVjtFONZIXBR8tvH1AAyL 7C0M5d8gZdLBSYNKEAgHv81vMKVzLSFW+/CHD85/trE4dQzNqWpzFxMhKWEeXmJcEs7A wxDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=hkNfxgC2YLQFMqZWOCiI4CofWeHNYOS5cHbeZCuOgxA=; b=QdW8Qv7selUuFXy52BqAhVUC5zbtNCQwbaiURNyZQlbwu1g/dH0mjvaz/DwkJ7MGAF vSU0qe0CECgqY75Pkx5ei+hyVxSjuwvZS09Wgk9icuqjzNO+RlreAp6BBpsd8ZVakLp9 wVG0ibLbLNTxiDpkEl7V5J8kQgitCfpZzBvN1R9iwHLewJ6l2vZT6Umk91Y8wtK7mFiO h9JNLPfo3ooKCrRsxzT/NgYzKzKsabmkt/0sX4hMb5iCK6GQ4VHko4IZPpg9Yv7sfZ0M hoaqGBkkjL4Y6dbpgRmYOq+2hRdKtZXRxz37tpqPDjF4tRRVXq3PHf7VJyajQYfxkfBf vqgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=bxfN2QEf; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h11-20020a056a00218b00b0057349f5fa8asi14858249pfi.112.2022.12.04.21.35.20; Sun, 04 Dec 2022 21:35:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=bxfN2QEf; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231593AbiLEFR2 (ORCPT + 83 others); Mon, 5 Dec 2022 00:17:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231592AbiLEFRZ (ORCPT ); Mon, 5 Dec 2022 00:17:25 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A857664F4 for ; Sun, 4 Dec 2022 21:17:22 -0800 (PST) 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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