xfs: remove kmem_zalloc_greedy
Subsystems (3)
PATCH v2 1/1 xfs: remove kmem_zalloc_greedy
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
@@ -25,24 +25,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 *ptr) } -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
@@ -362,7 +362,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 */
@@ -389,11 +388,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
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Looks fine,
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 7 lines · Darrick J. Wong
The sole remaining caller of
kmem_zalloc_greedyis 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 ofkmem_zalloc_large. This makes bulkstat somewhat more likely to ENOMEM if there's really no pages to spare, but eliminates a source of hangs.
Quoted 6 lines
[1] http://lkml.kernel.org/r/20170301044634.rgidgdqqiiwsmfpj%40XZHOUW.usersys.redhat.com
Signed-off-by Darrick J. Wong <[email protected]>---
v2: remove single-page fallback
---
Since this fixes a hang how about *at the very least* a respective Fixes tag ? This fixes an existing hang so what are the stable considerations here ? I realize the answer is not easy but figured its worth asking.
FWIW I trace kmem_zalloc_greedy()'s introduction back to 2006 77e4635ae1917 ("[XFS] Add a greedy allocation interface, allocating within a min/max size range.") through v2.6.19 days...
Luis
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Luis R. Rodriguez
Quoted 9 lines · Darrick J. Wong
The sole remaining caller of
kmem_zalloc_greedyis 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 ofkmem_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
Quoted 8 lines
Quoted 4 lines
Signed-off-by Darrick J. Wong <[email protected]>---
v2: remove single-page fallback
---Since this fixes a hang how about *at the very least* a respective Fixes tag ? This fixes an existing hang so what are the stable considerations here ? I realize the answer is not easy but figured its worth asking.
I didn't think it was appropriate to "Fixes: 77e4635ae1917" since we're not fixing _greedy so much as we are killing it. The patch fixes an infinite retry hang when bulkstat tries a memory allocation that cannot be satisfied; and having done that, realizes there are no remaining callers of _greedy and garbage collects it. The code that was there before also seems capable of sleeping forever, I think.
So the minimally invasive fix is to apply the allocation conversion in bulkstat, and if there aren't any other callers of _greedy then you can get rid of it too.
Quoted 3 lines
FWIW I trace kmem_zalloc_greedy()'s introduction back to 2006
77e4635ae1917("[XFS] Add a greedy allocation interface, allocating within a min/max size range.") through v2.6.19 days...
--D
Quoted 6 lines
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 27 lines · Darrick J. Wong
Quoted 10 lines · Luis R. Rodriguez
Quoted 9 lines · Darrick J. Wong
The sole remaining caller of
kmem_zalloc_greedyis 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 ofkmem_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
Quoted 8 lines
Quoted 4 lines
Signed-off-by Darrick J. Wong <[email protected]>---
v2: remove single-page fallback
---Since this fixes a hang how about *at the very least* a respective Fixes tag ? This fixes an existing hang so what are the stable considerations here ? I realize the answer is not easy but figured its worth asking.
I didn't think it was appropriate to "Fixes:
77e4635ae1917" since we're not fixing_greedyso much as we are killing it. The patch fixes an infinite retry hang when bulkstat tries a memory allocation that cannot be satisfied; and having done that, realizes there are no remaining callers of_greedyand garbage collects it. The code that was there before also seems capable of sleeping forever, I think.
Quoted 3 lines
So the minimally invasive fix is to apply the allocation conversion in bulkstat, and if there aren't any other callers of
_greedythen you can get rid of it too.
For the stake of stable XFS users then why not do the less invasive change first, Cc stable, and then move on to the less backward portable solution ?
Luis
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 28 lines · Luis R. Rodriguez
Quoted 27 lines · Darrick J. Wong
Quoted 10 lines · Luis R. Rodriguez
Quoted 9 lines · Darrick J. Wong
The sole remaining caller of
kmem_zalloc_greedyis 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 ofkmem_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
Quoted 8 lines
Quoted 4 lines
Signed-off-by Darrick J. Wong <[email protected]>---
v2: remove single-page fallback
---Since this fixes a hang how about *at the very least* a respective Fixes tag ? This fixes an existing hang so what are the stable considerations here ? I realize the answer is not easy but figured its worth asking.
I didn't think it was appropriate to "Fixes:
77e4635ae1917" since we're not fixing_greedyso much as we are killing it. The patch fixes an infinite retry hang when bulkstat tries a memory allocation that cannot be satisfied; and having done that, realizes there are no remaining callers of_greedyand garbage collects it. The code that was there before also seems capable of sleeping forever, I think.
Quoted 6 lines
Quoted 3 lines
So the minimally invasive fix is to apply the allocation conversion in bulkstat, and if there aren't any other callers of
_greedythen you can get rid of it too.For the stake of stable XFS users then why not do the less invasive change first, Cc stable, and then move on to the less backward portable solution ?
The thing is that the permanent failures for vmalloc were so unlikely prior to 5d17a73a2ebe ("vmalloc: back off when the current task is killed") that this was basically a non-issue before this (4.11) merge window.
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 33 lines · Michal Hocko
Quoted 32 lines · Luis R. Rodriguez
Quoted 30 lines · Darrick J. Wong
Quoted 10 lines · Luis R. Rodriguez
Quoted 9 lines · Darrick J. Wong
The sole remaining caller of
kmem_zalloc_greedyis 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 ofkmem_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
Quoted 8 lines
Quoted 4 lines
Signed-off-by Darrick J. Wong <[email protected]>---
v2: remove single-page fallback
---Since this fixes a hang how about *at the very least* a respective Fixes tag ? This fixes an existing hang so what are the stable considerations here ? I realize the answer is not easy but figured its worth asking.
I didn't think it was appropriate to "Fixes:
77e4635ae1917" since we're not fixing_greedyso much as we are killing it. The patch fixes an infinite retry hang when bulkstat tries a memory allocation that cannot be satisfied; and having done that, realizes there are no remaining callers of_greedyand garbage collects it. The code that was there before also seems capable of sleeping forever, I think.So the minimally invasive fix is to apply the allocation conversion in bulkstat, and if there aren't any other callers of
_greedythen you can get rid of it too.
Quoted 7 lines
Quoted 2 lines
For the stake of stable XFS users then why not do the less invasive change first, Cc stable, and then move on to the less backward portable solution ?
The thing is that the permanent failures for vmalloc were so unlikely prior to
5d17a73a2ebe("vmalloc: back off when the current task is killed") that this was basically a non-issue before this (4.11) merge window.
I see, this seems like critical information to add to the commit log. Also, will this be at least pushed to v4.11 ?
Luis
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 37 lines · Luis R. Rodriguez
Quoted 36 lines · Michal Hocko
Quoted 34 lines · Luis R. Rodriguez
Quoted 27 lines · Darrick J. Wong
Quoted 10 lines · Luis R. Rodriguez
Quoted 9 lines · Darrick J. Wong
The sole remaining caller of
kmem_zalloc_greedyis 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 ofkmem_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
Quoted 8 lines
Quoted 4 lines
Signed-off-by Darrick J. Wong <[email protected]>---
v2: remove single-page fallback
---Since this fixes a hang how about *at the very least* a respective Fixes tag ? This fixes an existing hang so what are the stable considerations here ? I realize the answer is not easy but figured its worth asking.
I didn't think it was appropriate to "Fixes:
77e4635ae1917" since we're not fixing_greedyso much as we are killing it. The patch fixes an infinite retry hang when bulkstat tries a memory allocation that cannot be satisfied; and having done that, realizes there are no remaining callers of_greedyand garbage collects it. The code that was there before also seems capable of sleeping forever, I think.Quoted 3 lines
So the minimally invasive fix is to apply the allocation conversion in bulkstat, and if there aren't any other callers of
_greedythen you can get rid of it too.For the stake of stable XFS users then why not do the less invasive change first, Cc stable, and then move on to the less backward portable solution ?
Quoted 7 lines
Quoted 4 lines
The thing is that the permanent failures for vmalloc were so unlikely prior to
5d17a73a2ebe("vmalloc: back off when the current task is killed") that this was basically a non-issue before this (4.11) merge window.I see, this seems like critical information to add to the commit log. Also, will this be at least pushed to v4.11 ?
It's already in rc2.
--D
Quoted 6 lines
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>