From: Matthew Wilcox <willy@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/3] mm: Add kvrealloc()
Date: Fri, 25 Jun 2021 04:54:11 +0100 [thread overview]
Message-ID: <YNVTY0uNdYz8xYp5@casper.infradead.org> (raw)
In-Reply-To: <20210625023029.1472466-2-david@fromorbit.com>
On Fri, Jun 25, 2021 at 12:30:27PM +1000, Dave Chinner wrote:
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 8ae31622deef..34d88ff00f31 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -830,6 +830,20 @@ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
> extern void kvfree(const void *addr);
> extern void kvfree_sensitive(const void *addr, size_t len);
>
> +static inline void *kvrealloc(void *p, size_t oldsize, size_t newsize,
> + gfp_t flags)
> +{
> + void *newp;
> +
> + if (oldsize >= newsize)
> + return p;
> + newp = kvmalloc(newsize, flags);
> + memcpy(newp, p, oldsize);
> + kvfree(p);
> + return newp;
> +}
Why make this an inline function instead of putting it in mm/util.c?
next prev parent reply other threads:[~2021-06-25 3:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2021-06-25 5:02 ` Dave Chinner
2021-06-25 2:30 ` [PATCH 2/3] xfs: remove kmem_alloc_io() Dave Chinner
2021-06-26 2:01 ` Darrick J. Wong
2021-06-27 22:09 ` Dave Chinner
2021-06-27 23:14 ` Darrick J. Wong
2021-06-25 2:30 ` [PATCH 3/3] xfs: replace kmem_alloc_large() with kvmalloc() Dave Chinner
2021-06-26 2:06 ` Darrick J. Wong
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-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
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=YNVTY0uNdYz8xYp5@casper.infradead.org \
--to=willy@infradead.org \
--cc=david@fromorbit.com \
--cc=linux-mm@kvack.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox