All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3 v3] xfs, mm: memory allocation improvements
@ 2021-07-14  2:34 Dave Chinner
  2021-07-14  2:34 ` [PATCH 1/3] mm: Add kvrealloc() Dave Chinner
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Dave Chinner @ 2021-07-14  2:34 UTC (permalink / raw)
  To: linux-xfs; +Cc: linux-mm

We're slowly trying to move the XFS code closer to the common memory
allocation routines everyone else uses. This patch set addresses a
regression from a previous set of changes (kmem_realloc() removal)
and removes another couple of kmem wrappers from within the XFS
code.

The first patch addresses a regression - using large directory
blocks triggers a warning when calling krealloc() recombine a buffer
split across across two log records into a single contiguous
memory buffer. this results in krealloc() being called to allocate a
64kB buffer with __GFP_NOFAIL being set. This warning is trivially
reproduced by generic/040 and generic/041 when run with 64kB
directory block sizes on a 4kB page size machine.

Log recovery really needs to use kvmalloc() like all the other
"allocate up to 64kB and can't fail" cases in filesystem code (e.g.
for xattrs), but there's no native kvrealloc() function that
provides us with the necessary semantics. So rather than add a new
wrapper, the first patch adds this helper to the common code and
converts XFS to use it for log recovery.

The latter two patches are removing what are essentially kvmalloc()
wrappers from XFS. With the more widespread use of
memalloc_nofs_save/restore(), we can call kvmalloc(GFP_KERNEL) and
just have it do the right thing because GFP_NOFS contexts are
covered by PF_MEMALLOC_NOFS task flags now. Hence we don't need
kmem_alloc_large() anymore. And with the slab code guaranteeing at
least 512 byte alignment for sector and block sized heap
allocations, we no longer need the kmem_alloc_io() variant of
kmem_alloc_large() for IO buffers. So these wrappers can all go
away...

Version 3:
- rebase on v5.14-rc1
- handle kvrealloc() failure in xlog_recover_add_to_cont_trans()

Version 2:
- https://lore.kernel.org/linux-xfs/20210630061431.1750745-1-david@fromorbit.com/
- rebase on v5.13 + xfs/for-next
- moved kvrealloc() to mm/util.c
- made incoming pointer const void *
- added null check for vmalloc() failure
- removed xfs_buftarg_dma_alignment()

Original:
- https://lore.kernel.org/linux-xfs/20210625023029.1472466-1-david@fromorbit.com/


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [PATCH 0/3 v2] mm, xfs: memory allocation improvements
@ 2021-06-30  6:14 Dave Chinner
  2021-06-30  6:14 ` [PATCH 1/3] mm: Add kvrealloc() Dave Chinner
  0 siblings, 1 reply; 16+ messages in thread
From: Dave Chinner @ 2021-06-30  6:14 UTC (permalink / raw)
  To: linux-xfs, linux-mm

HI folks,

This is an updated version of the patch series first posted here:

https://lore.kernel.org/linux-xfs/20210625023029.1472466-1-david@fromorbit.com/

Changes in this version can be found in the changelog below.

Cheers,

Dave.

-----

We're slowly trying to move the XFS code closer to the common memory
allocation routines everyone else uses. This patch set addresses a
regression from a previous set of changes (kmem_realloc() removal)
and removes another couple of kmem wrappers from within the XFS
code.

The first patch addresses a regression - using large directory
blocks triggers a warning when calling krealloc() recombine a buffer
split across across two log records into a single contiguous
memory buffer. this results in krealloc() being called to allocate a
64kB buffer with __GFP_NOFAIL being set. This warning is trivially
reproduced by generic/040 and generic/041 when run with 64kB
directory block sizes on a 4kB page size machine.

Log recovery really needs to use kvmalloc() like all the other
"allocate up to 64kB and can't fail" cases in filesystem code (e.g.
for xattrs), but there's no native kvrealloc() function that
provides us with the necessary semantics. So rather than add a new
wrapper, the first patch adds this helper to the common code and
converts XFS to use it for log recovery.

The latter two patches are removing what are essentially kvmalloc()
wrappers from XFS. With the more widespread use of
memalloc_nofs_save/restore(), we can call kvmalloc(GFP_KERNEL) and
just have it do the right thing because GFP_NOFS contexts are
covered by PF_MEMALLOC_NOFS task flags now. Hence we don't need
kmem_alloc_large() anymore. And with the slab code guaranteeing at
least 512 byte alignment for sector and block sized heap
allocations, we no longer need the kmem_alloc_io() variant of
kmem_alloc_large() for IO buffers. So these wrappers can all go
away...

Version 2:
- move kvrealloc to mm/util.c
- check for null being returned by vmalloc
- remove unused xfs_buftarg_dma_alignment()




^ permalink raw reply	[flat|nested] 16+ messages in thread
* [PATCH 0/3] mm, xfs: memory allocation improvements
@ 2021-06-25  2:30 Dave Chinner
  2021-06-25  2:30 ` [PATCH 1/3] mm: Add kvrealloc() Dave Chinner
  0 siblings, 1 reply; 16+ messages in thread
From: Dave Chinner @ 2021-06-25  2:30 UTC (permalink / raw)
  To: linux-xfs, linux-mm

Hi folks,

We're slowly trying to move the XFS code closer to the common memory
allocation routines everyone else uses. This patch set addresses a
regression from a previous set of changes (kmem_realloc() removal)
and removes another couple of kmem wrappers from within the XFS
code.

The first patch addresses a regression - using large directory
blocks triggers a warning when calling krealloc() recombine a buffer
split across across two log records into a single contiguous
memory buffer. this results in krealloc() being called to allocate a
64kB buffer with __GFP_NOFAIL being set. This warning is trivially
reproduced by generic/040 and generic/041 when run with 64kB
directory block sizes on a 4kB page size machine.

Log recovery really needs to use kvmalloc() like all the other
"allocate up to 64kB and can't fail" cases in filesystem code (e.g.
for xattrs), but there's no native kvrealloc() function that
provides us with the necessary semantics. So rather than add a new
wrapper, the first patch adds this helper to the common code and
converts XFS to use it for log recovery.

The latter two patches are removing what are essentially kvmalloc()
wrappers from XFS. With the more widespread use of
memalloc_nofs_save/restore(), we can call kvmalloc(GFP_KERNEL) and
just have it do the right thing because GFP_NOFS contexts are
covered by PF_MEMALLOC_NOFS task flags now. Hence we don't need
kmem_alloc_large() anymore. And with the slab code guaranteeing at
least 512 byte alignment for sector and block sized heap
allocations, we no longer need the kmem_alloc_io() variant of
kmem_alloc_large() for IO buffers. So these wrappers can all go
away...

Cheers,

Dave.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-07-14 21:15 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14  2:34 [PATCH 0/3 v3] xfs, mm: memory allocation improvements Dave Chinner
2021-07-14  2:34 ` [PATCH 1/3] mm: Add kvrealloc() Dave Chinner
2021-07-14 11:05   ` Mel Gorman
2021-07-14 21:15   ` Darrick J. Wong
2021-07-14  2:34 ` [PATCH 2/3] xfs: remove kmem_alloc_io() Dave Chinner
2021-07-14  2:34 ` [PATCH 3/3] xfs: replace kmem_alloc_large() with kvmalloc() Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2021-06-30  6:14 [PATCH 0/3 v2] mm, xfs: memory allocation improvements Dave Chinner
2021-06-30  6:14 ` [PATCH 1/3] mm: Add kvrealloc() Dave Chinner
2021-06-30 10:04   ` Mel Gorman
2021-06-30 12:05     ` Michal Hocko
2021-06-30 16:08   ` Darrick J. Wong
2021-06-30 21:49     ` Dave Chinner
2021-06-25  2:30 [PATCH 0/3] mm, xfs: memory allocation improvements Dave Chinner
2021-06-25  2:30 ` [PATCH 1/3] mm: Add kvrealloc() Dave Chinner
2021-06-25  2:40   ` Miaohe Lin
2021-06-25  5:05     ` Dave Chinner
2021-06-25  3:54   ` Matthew Wilcox
2021-06-25  5:02     ` Dave Chinner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.