Patch "scsi: sd_zbc: Use kvzalloc() to allocate REPORT ZONES buffer" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: sd_zbc: Use kvzalloc() to allocate REPORT ZONES buffer

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-sd_zbc-use-kvzalloc-to-allocate-report-zones-bu.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit dcb27ffd179b9de7c2887f44dd6606506d0ace50
Author: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
Date:   Wed Oct 30 12:02:53 2024 +0100

    scsi: sd_zbc: Use kvzalloc() to allocate REPORT ZONES buffer
    
    [ Upstream commit 7ce3e6107103214d354a16729a472f588be60572 ]
    
    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@xxxxxxxx>
    Cc: Naohiro Aota <naohiro.aota@xxxxxxx>
    Link: https://github.com/kdave/btrfs-progs/issues/779
    Link: https://github.com/kdave/btrfs-progs/issues/915
    Fixes: 23a50861adda ("scsi: sd_zbc: Cleanup sd_zbc_alloc_report_buffer()")
    Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
    Link: https://lore.kernel.org/r/20241030110253.11718-1-jth@xxxxxxxxxx
    Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 4c35b4a916355..4c78288ffa72f 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -216,8 +216,7 @@ static void *sd_zbc_alloc_report_buffer(struct scsi_disk *sdkp,
 	bufsize = min_t(size_t, bufsize, queue_max_segments(q) << PAGE_SHIFT);
 
 	while (bufsize >= SECTOR_SIZE) {
-		buf = __vmalloc(bufsize,
-				GFP_KERNEL | __GFP_ZERO | __GFP_NORETRY);
+		buf = kvzalloc(bufsize, GFP_KERNEL | __GFP_NORETRY);
 		if (buf) {
 			*buflen = bufsize;
 			return buf;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux