[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221121175619.f38259bac177de86bd9eb558@linux-foundation.org>
Date: Mon, 21 Nov 2022 17:56:19 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: Seth Jennings <sjenning@...hat.com>,
Dan Streetman <ddstreet@...e.org>,
Vitaly Wool <vitaly.wool@...sulko.com>,
Nhat Pham <nphamcs@...il.com>,
Johannes Weiner <hannes@...xchg.org>,
Minchan Kim <minchan@...nel.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] zswap: do not allocate from atomic pool
On Tue, 22 Nov 2022 10:33:38 +0900 Sergey Senozhatsky <senozhatsky@...omium.org> wrote:
> zswap_frontswap_load() should be called from preemptible
> context (we even call mutex_lock() there) and it does not
> look like we need to do GFP_ATOMIC allocaion for temp
> buffer there. Use GFP_KERNEL instead.
>
> ...
>
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -1314,7 +1314,7 @@ static int zswap_frontswap_load(unsigned type, pgoff_t offset,
> }
>
> if (!zpool_can_sleep_mapped(entry->pool->zpool)) {
> - tmp = kmalloc(entry->length, GFP_ATOMIC);
> + tmp = kmalloc(entry->length, GFP_KERNEL);
> if (!tmp) {
> ret = -ENOMEM;
> goto freeentry;
It seems strange to do
if (! can sleep)
do something which can sleep
or am I misreading the intent of zpool_driver.sleep_mapped? If so,
perhaps some explanatory code comments will help.
Powered by blists - more mailing lists