Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Johannes Thumshirn <jth@kernel.org>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Qu Wenru <wqu@suse.com>, Naohiro Aota <naohiro.aota@wdc.com>
Subject: Re: [PATCH] scsi: sd_zbc: use kvzalloc to allocate report zones buffer
Date: Thu, 31 Oct 2024 08:49:31 +0900	[thread overview]
Message-ID: <6444d196-9194-4eac-b85c-f2fca006bf08@kernel.org> (raw)
In-Reply-To: <20241030110253.11718-1-jth@kernel.org>

On 10/30/24 8:02 PM, Johannes Thumshirn wrote:
> From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> 
> We have two reports of failed memory allocation in btrfs' code which is
> calling into report zones.
> 
> Both of these reports have the following signature coming from
> __vmalloc_area_node():
> 
>  kworker/u17:5: vmalloc error: size 0, failed to allocate pages, mode:0x10dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NORETRY|__GFP_ZERO), nodemask=(null),cpuset=/,mems_allowed=0
> 
> Further debugging showed these where allocations of one sector (512 bytes)
> and at least one of the reporter's systems where low on memory, so going
> through the overhead of allocating a vm area failed.
> 
> Switching the allocation from __vmalloc() to kvzalloc() avoids the
> overhead of vmalloc() on small allocations and succeeds.
> 
> Note: the buffer is already freed using kvfree() so there's no need to
> adjust the free path.
> 
> Cc: Qu Wenru <wqu@suse.com>
> Cc: Naohiro Aota <naohiro.aota@wdc.com>
> Link: https://github.com/kdave/btrfs-progs/issues/779
> Link: https://github.com/kdave/btrfs-progs/issues/915
> Fixes: Fixes: 23a50861adda ("scsi: sd_zbc: Cleanup sd_zbc_alloc_report_buffer()")
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Looks good.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2024-10-30 23:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30 11:02 [PATCH] scsi: sd_zbc: use kvzalloc to allocate report zones buffer Johannes Thumshirn
2024-10-30 23:49 ` Damien Le Moal [this message]
2024-11-07  8:46 ` Johannes Thumshirn
2024-11-07 21:01   ` Martin K. Petersen
2024-11-08  7:00     ` Johannes Thumshirn

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=6444d196-9194-4eac-b85c-f2fca006bf08@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=johannes.thumshirn@wdc.com \
    --cc=jth@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=naohiro.aota@wdc.com \
    --cc=wqu@suse.com \
    /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