Re: [PATCH RFC 4/4] mm/page_alloc_test: Add smoke-test for page allocation

From: Brendan Jackman
Date: Wed Feb 26 2025 - 05:54:31 EST


On Mon, 24 Feb 2025 at 15:47, Brendan Jackman <jackmanb@xxxxxxxxxx> wrote:
> +static inline struct page *alloc_pages_force_nid(struct kunit *test,
> + gfp_t gfp, int order, int nid)
> +{
> + NODEMASK_ALLOC(nodemask_t, nodemask, GFP_KERNEL);
> + struct page *page;
> +
> + KUNIT_ASSERT_NOT_NULL(test, nodemask);
> + kunit_add_action(test, action_nodemask_free, &nodemask);
> + nodes_clear(*nodemask);
> + node_set(nid, *nodemask);
> +
> + page = __alloc_pages_noprof(GFP_KERNEL, 0, nid, nodemask);

Oops, it's ignoring the gfp argument here.

> + { .gfp_flags = GFP_DMA32, .want_zone = ZONE_NORMAL },

And with that fixed, it becomes clear DMA32 allocations can't be
expected to succeed in this zone setup.

(Anyway, it's a bit of a silly test regardless, just something to
illustrate the KUnit idea).