From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Carlos Maiolino <cmaiolino@redhat.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 11/11] xfs: Remove kmem_alloc_{io, large} and kmem_zalloc_large
Date: Thu, 14 Nov 2019 07:06:20 +1100 [thread overview]
Message-ID: <20191113200620.GU4614@dread.disaster.area> (raw)
In-Reply-To: <20191113182343.GH6219@magnolia>
On Wed, Nov 13, 2019 at 10:23:43AM -0800, Darrick J. Wong wrote:
> On Wed, Nov 13, 2019 at 03:23:35PM +0100, Carlos Maiolino wrote:
> > Getting rid of these functions, is a bit more complicated, giving the
> > fact they use a vmalloc fallback, and (in case of _io version) uses an
> > alignment check, so they have their useness.
> >
> > Instead of keeping both of them, I think sharing the same function for
> > both cases is a more interesting idea, giving the fact they both have
> > the same purpose, with the only difference being the alignment check,
> > which can be selected by using a flag.
> >
> > Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> > ---
> > fs/xfs/kmem.c | 39 +++++++++++------------------------
> > fs/xfs/kmem.h | 10 +--------
> > fs/xfs/libxfs/xfs_attr_leaf.c | 2 +-
> > fs/xfs/scrub/attr.c | 2 +-
> > fs/xfs/scrub/symlink.c | 3 ++-
> > fs/xfs/xfs_acl.c | 3 ++-
> > fs/xfs/xfs_buf.c | 4 ++--
> > fs/xfs/xfs_ioctl.c | 8 ++++---
> > fs/xfs/xfs_ioctl32.c | 3 ++-
> > fs/xfs/xfs_log.c | 5 +++--
> > fs/xfs/xfs_log_cil.c | 2 +-
> > fs/xfs/xfs_log_recover.c | 4 ++--
> > fs/xfs/xfs_rtalloc.c | 3 ++-
> > 13 files changed, 36 insertions(+), 52 deletions(-)
> >
> > diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c
> > index 44145293cfc9..bb4990970647 100644
> > --- a/fs/xfs/kmem.c
> > +++ b/fs/xfs/kmem.c
> > @@ -8,40 +8,25 @@
> > #include "xfs_message.h"
> > #include "xfs_trace.h"
> >
> > -/*
> > - * Same as kmem_alloc_large, except we guarantee the buffer returned is aligned
> > - * to the @align_mask. We only guarantee alignment up to page size, we'll clamp
> > - * alignment at page size if it is larger. vmalloc always returns a PAGE_SIZE
> > - * aligned region.
> > - */
> > void *
> > -kmem_alloc_io(size_t size, int align_mask, gfp_t flags)
> > +xfs_kmem_alloc(size_t size, gfp_t flags, bool align, int align_mask)
>
> A boolean for the align /and/ an alignment mask? Yuck.
>
> I think I'd rather have:
>
> void *
> kmem_alloc(
> size_t size,
> gfp_t flags,
> unsigned int align_mask)
> {
> ... allocation logic ...
> }
If you avoid changing the order of the flags/alignmask parameters,
most of the churn in this patch goes away.
>
> and in kmem.h:
>
> static inline void *
> kmem_alloc_io(
> size_t size,
> gfp_t flags,
> unsigned int align_mask)
> {
> trace_kmem_alloc_io(size, flags, align_mask, _RET_IP_);
> return kmem_alloc(size, flags, align_mask);
> }
This should be able to go away soon, because the heap allocator will
guarantee alignment soon. That means kmem.c is a single function,
and kmem.h is a single function. I'd be looking to move the two
helper functions into some other utility file at that point
(fsops?)...
ANother question: how much work is there to be done on the userspace
side of things?
> > */
> >
> > -extern void *kmem_alloc_io(size_t size, int align_mask, gfp_t flags);
> > -extern void *kmem_alloc_large(size_t size, gfp_t);
> > +extern void *xfs_kmem_alloc(size_t, gfp_t, bool, int);
> > static inline void kmem_free(const void *ptr)
> > {
> > kvfree(ptr);
> > }
Didn't an earlier patch get rid of kmem_free(), or am I just
imagining this? Seems silly to leave this behind, now that the
only place that needs kvfree() is the callers to kmem_alloc_io and
kmem_alloc_large...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2019-11-13 20:06 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-13 14:23 [PATCH 00/11] Use generic memory API instead of a custom one Carlos Maiolino
2019-11-13 14:23 ` [PATCH 01/11] xfs: Remove slab init wrappers Carlos Maiolino
2019-11-13 17:06 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 02/11] xfs: Remove kmem_zone_destroy() wrapper Carlos Maiolino
2019-11-13 17:06 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 03/11] xfs: Remove kmem_zone_free() wrapper Carlos Maiolino
2019-11-13 17:08 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 04/11] xfs: remove kmem_zone_zalloc() Carlos Maiolino
2019-11-13 17:18 ` Darrick J. Wong
2019-11-13 20:27 ` Carlos Maiolino
2019-11-13 14:23 ` [PATCH 05/11] xfs: Remove kmem_zone_alloc() wrapper Carlos Maiolino
2019-11-13 17:28 ` Darrick J. Wong
2019-11-13 18:12 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 06/11] xfs: remove kmem_zalloc() wrapper Carlos Maiolino
2019-11-13 17:34 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 07/11] xfs: Remove kmem_realloc Carlos Maiolino
2019-11-13 17:40 ` Darrick J. Wong
2019-11-13 18:10 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 08/11] xfs: Convert kmem_alloc() users Carlos Maiolino
2019-11-13 17:49 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 09/11] xfs: rework kmem_alloc_{io,large} to use GFP_* flags Carlos Maiolino
2019-11-13 18:08 ` Darrick J. Wong
2019-11-13 19:56 ` Dave Chinner
2019-11-14 9:40 ` Carlos Maiolino
2019-11-14 10:31 ` Carlos Maiolino
2019-11-13 14:23 ` [PATCH 10/11] xfs: Remove KM_* flags Carlos Maiolino
2019-11-13 18:14 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 11/11] xfs: Remove kmem_alloc_{io, large} and kmem_zalloc_large Carlos Maiolino
2019-11-13 18:23 ` Darrick J. Wong
2019-11-13 20:06 ` Dave Chinner [this message]
2019-11-13 20:43 ` Eric Sandeen
2019-11-14 9:46 ` Carlos Maiolino
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=20191113200620.GU4614@dread.disaster.area \
--to=david@fromorbit.com \
--cc=cmaiolino@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/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 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.