From: Johannes Weiner <hannes@cmpxchg.org>
To: Vitaly Wool <vitaly.wool@konsulko.se>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, Nhat Pham <nphamcs@gmail.com>,
Shakeel Butt <shakeel.butt@linux.dev>,
Yosry Ahmed <yosry.ahmed@linux.dev>,
Minchan Kim <minchan@kernel.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Igor Belousov <igor.b@beldev.am>
Subject: Re: [PATCH] mm/zblock: use vmalloc for page allocations
Date: Mon, 5 May 2025 10:29:49 -0400 [thread overview]
Message-ID: <20250505142949.GB30814@cmpxchg.org> (raw)
In-Reply-To: <20250502080156.1672957-1-vitaly.wool@konsulko.se>
On Fri, May 02, 2025 at 10:01:56AM +0200, Vitaly Wool wrote:
> static struct zblock_block *alloc_block(struct zblock_pool *pool,
> int block_type, gfp_t gfp,
> - unsigned long *handle)
> + unsigned long *handle,
> + unsigned int nid)
> {
> + struct block_list *block_list = &pool->block_lists[block_type];
> + unsigned int num_pages = block_desc[block_type].num_pages;
> struct zblock_block *block;
> - struct block_list *block_list;
> + struct page *page = NULL;
>
> - block = (void *)__get_free_pages(gfp, block_desc[block_type].order);
> - if (!block)
> - return NULL;
> + if (!vmalloc_small_blocks && zblock_get_order(num_pages) >= 0) {
> + page = try_alloc_pages(nid, zblock_get_order(num_pages));
This is broken in several ways.
The function is meant for NMI contexts - the "try" refers to
trylocking the freelists, in case whatever got interrupted was inside
the allocator already. This will fall back to vmalloc unpredictably.
It also doesn't take a gfp parameter, which ignores the zswap ones,
and substitutes a set that doesn't make any sense in this context:
__GFP_NOMEMALLOC is counter productive inside reclaim; __GFP_ACCOUNT
wreaks complete havoc on how compressed memory is charged to cgroups
(double charging the wrong groups for shared blocks).
next prev parent reply other threads:[~2025-05-05 14:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-02 8:01 Vitaly Wool
2025-05-02 8:07 ` Igor Belousov
2025-05-03 18:46 ` Vitaly Wool
2025-05-04 5:02 ` Sergey Senozhatsky
2025-05-04 6:14 ` Sergey Senozhatsky
2025-05-05 14:08 ` Johannes Weiner
2025-05-06 2:13 ` Sergey Senozhatsky
2025-05-05 14:29 ` Johannes Weiner [this message]
2025-05-06 9:42 ` Uladzislau Rezki
2025-05-06 13:13 ` Yosry Ahmed
2025-05-06 13:27 ` Herbert Xu
2025-05-06 13:37 ` Christoph Hellwig
2025-05-07 5:57 ` Sergey Senozhatsky
2025-05-07 6:08 ` Sergey Senozhatsky
2025-05-07 6:14 ` Sergey Senozhatsky
2025-05-07 6:54 ` Christoph Hellwig
2025-05-08 5:58 ` Sergey Senozhatsky
2025-05-08 6:00 ` Christoph Hellwig
2025-05-08 6:17 ` Sergey Senozhatsky
2025-05-08 6:33 ` Sergey Senozhatsky
2025-05-07 8:50 ` Uladzislau Rezki
2025-05-08 6:07 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250505142949.GB30814@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=igor.b@beldev.am \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=nphamcs@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=shakeel.butt@linux.dev \
--cc=vitaly.wool@konsulko.se \
--cc=yosry.ahmed@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox