Patch "xfs: remove kmem_zalloc_greedy" has been added to the 4.4-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
xfs: remove kmem_zalloc_greedy
to the 4.4-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:
xfs-remove-kmem_zalloc_greedy.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Thu Oct 5 10:49:14 CEST 2017
From: "Darrick J. Wong" <[email protected]>
Date: Mon, 6 Mar 2017 11:58:20 -0800
Subject: xfs: remove kmem_zalloc_greedy
From: "Darrick J. Wong" <[email protected]>
[ Upstream commit 08b005f1333154ae5b404ca28766e0ffb9f1c150 ]
The sole remaining caller of kmem_zalloc_greedy is bulkstat, which uses it to grab 1-4 pages for staging of inobt records. The infinite loop in the greedy allocation function is causing hangs[1] in generic/269, so just get rid of the greedy allocator in favor of kmem_zalloc_large. This makes bulkstat somewhat more likely to ENOMEM if there's really no pages to spare, but eliminates a source of hangs.
[1] http://lkml.kernel.org/r/20170301044634.rgidgdqqiiwsmfpj%40XZHOUW.usersys.redhat.com
---
v2: remove single-page fallback
--- fs/xfs/kmem.c | 18 ------------------ fs/xfs/kmem.h | 2 -- fs/xfs/xfs_itable.c | 6 ++---- 3 files changed, 2 insertions(+), 24 deletions(-)
fs/xfs/kmem.c +0 -18
@@ -24,24 +24,6 @@#include "kmem.h" #include "xfs_message.h" -/* -* Greedy allocation. May fail and may return vmalloced memory. -*/ -void * -kmem_zalloc_greedy (size_t *size,size_t minsize,size_t maxsize) -{ -void *ptr; -size_t kmsize = maxsize; - -while (!(ptr =vzalloc (kmsize))) { -if ((kmsize >>=1 ) <= minsize) - kmsize = minsize; - } -if (ptr) - *size = kmsize; -return ptr; -} -void *kmem_alloc (size_t size,xfs_km_flags_t flags) {
fs/xfs/kmem.h +0 -2
@@ -69,8 +69,6 @@ static inline void kmem_free(const void } -extern void *kmem_zalloc_greedy (size_t *,size_t ,size_t ); -static inline void *kmem_zalloc (size_t size,xfs_km_flags_t flags) {
fs/xfs/xfs_itable.c +2 -4
@@ -351,7 +351,6 @@ xfs_bulkstat(xfs_agino_t agino;/* inode # in allocation group */ xfs_agnumber_t agno;/* allocation group number */ xfs_btree_cur_t *cur;/* btree cursor for ialloc btree */ -size_t irbsize;/* size of irec buffer in bytes */ xfs_inobt_rec_incore_t *irbuf;/* start of irec buffer */ int nirbuf;/* size of irbuf */ int ubcount;/* size of user's buffer */
@@ -378,11 +377,10 @@ xfs_bulkstat( *ubcountp =0 ; *done =0 ; - irbuf =kmem_zalloc_greedy (&irbsize,PAGE_SIZE ,PAGE_SIZE *4 ); + irbuf =kmem_zalloc_large (PAGE_SIZE *4 ,KM_SLEEP );if (!irbuf)return -ENOMEM ; - - nirbuf = irbsize /sizeof (*irbuf); + nirbuf = (PAGE_SIZE *4 ) /sizeof (*irbuf);/* * Loop over the allocation groups, starting from the last
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/xfs-remove-kmem_zalloc_greedy.patch