linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: remove __krealloc
@ 2019-12-12 22:34 Florian Westphal
  2019-12-12 23:00 ` David Rientjes
  2019-12-13 10:17 ` David Hildenbrand
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Westphal @ 2019-12-12 22:34 UTC (permalink / raw)
  To: linux-mm
  Cc: cl, penberg, rientjes, iamjoonsoo.kim, akpm, linux-kernel,
	Florian Westphal

Since 5.5-rc1 the last user of this function is gone, so remove the
functionality.

See commit
2ad9d7747c10 ("netfilter: conntrack: free extension area immediately")
for details.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 include/linux/slab.h                    |  1 -
 mm/slab_common.c                        | 22 ----------------------
 scripts/coccinelle/free/devm_free.cocci |  4 ----
 3 files changed, 27 deletions(-)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 877a95c6a2d2..03a389358562 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -184,7 +184,6 @@ void memcg_deactivate_kmem_caches(struct mem_cgroup *, struct mem_cgroup *);
 /*
  * Common kmalloc functions provided by all allocators
  */
-void * __must_check __krealloc(const void *, size_t, gfp_t);
 void * __must_check krealloc(const void *, size_t, gfp_t);
 void kfree(const void *);
 void kzfree(const void *);
diff --git a/mm/slab_common.c b/mm/slab_common.c
index f0ab6d4ceb4c..87e8923cf0b6 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -1675,28 +1675,6 @@ static __always_inline void *__do_krealloc(const void *p, size_t new_size,
 	return ret;
 }
 
-/**
- * __krealloc - like krealloc() but don't free @p.
- * @p: object to reallocate memory for.
- * @new_size: how many bytes of memory are required.
- * @flags: the type of memory to allocate.
- *
- * This function is like krealloc() except it never frees the originally
- * allocated buffer. Use this if you don't want to free the buffer immediately
- * like, for example, with RCU.
- *
- * Return: pointer to the allocated memory or %NULL in case of error
- */
-void *__krealloc(const void *p, size_t new_size, gfp_t flags)
-{
-	if (unlikely(!new_size))
-		return ZERO_SIZE_PTR;
-
-	return __do_krealloc(p, new_size, flags);
-
-}
-EXPORT_SYMBOL(__krealloc);
-
 /**
  * krealloc - reallocate memory. The contents will remain unchanged.
  * @p: object to reallocate memory for.
diff --git a/scripts/coccinelle/free/devm_free.cocci b/scripts/coccinelle/free/devm_free.cocci
index 441799b5359b..66aaf68889a5 100644
--- a/scripts/coccinelle/free/devm_free.cocci
+++ b/scripts/coccinelle/free/devm_free.cocci
@@ -94,8 +94,6 @@ position p;
  kfree@p(x)
 |
  kzfree@p(x)
-|
- __krealloc@p(x, ...)
 |
  krealloc@p(x, ...)
 |
@@ -120,8 +118,6 @@ position p != safe.p;
 |
 * kzfree@p(x)
 |
-* __krealloc@p(x, ...)
-|
 * krealloc@p(x, ...)
 |
 * free_pages@p(x, ...)
-- 
2.23.0


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

* Re: [PATCH] mm: remove __krealloc
  2019-12-12 22:34 [PATCH] mm: remove __krealloc Florian Westphal
@ 2019-12-12 23:00 ` David Rientjes
  2019-12-12 23:18   ` Florian Westphal
  2019-12-13 10:17 ` David Hildenbrand
  1 sibling, 1 reply; 5+ messages in thread
From: David Rientjes @ 2019-12-12 23:00 UTC (permalink / raw)
  To: Florian Westphal
  Cc: linux-mm, cl, penberg, iamjoonsoo.kim, akpm, linux-kernel

On Thu, 12 Dec 2019, Florian Westphal wrote:

> Since 5.5-rc1 the last user of this function is gone, so remove the
> functionality.
> 
> See commit
> 2ad9d7747c10 ("netfilter: conntrack: free extension area immediately")
> for details.
> 
> Signed-off-by: Florian Westphal <fw@strlen.de>

So this also means that we can fold __do_krealloc() into krealloc()?

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

* Re: [PATCH] mm: remove __krealloc
  2019-12-12 23:00 ` David Rientjes
@ 2019-12-12 23:18   ` Florian Westphal
  2019-12-13 18:59     ` David Rientjes
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Westphal @ 2019-12-12 23:18 UTC (permalink / raw)
  To: David Rientjes
  Cc: Florian Westphal, linux-mm, cl, penberg, iamjoonsoo.kim, akpm,
	linux-kernel

David Rientjes <rientjes@google.com> wrote:
> On Thu, 12 Dec 2019, Florian Westphal wrote:
> 
> > Since 5.5-rc1 the last user of this function is gone, so remove the
> > functionality.
> > 
> > See commit
> > 2ad9d7747c10 ("netfilter: conntrack: free extension area immediately")
> > for details.
> > 
> > Signed-off-by: Florian Westphal <fw@strlen.de>
> 
> So this also means that we can fold __do_krealloc() into krealloc()?

I would leave that to compiler but if you prefer this I can respin.

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

* Re: [PATCH] mm: remove __krealloc
  2019-12-12 22:34 [PATCH] mm: remove __krealloc Florian Westphal
  2019-12-12 23:00 ` David Rientjes
@ 2019-12-13 10:17 ` David Hildenbrand
  1 sibling, 0 replies; 5+ messages in thread
From: David Hildenbrand @ 2019-12-13 10:17 UTC (permalink / raw)
  To: Florian Westphal, linux-mm
  Cc: cl, penberg, rientjes, iamjoonsoo.kim, akpm, linux-kernel

On 12.12.19 23:34, Florian Westphal wrote:
> Since 5.5-rc1 the last user of this function is gone, so remove the
> functionality.
> 
> See commit
> 2ad9d7747c10 ("netfilter: conntrack: free extension area immediately")
> for details.
> 
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>  include/linux/slab.h                    |  1 -
>  mm/slab_common.c                        | 22 ----------------------
>  scripts/coccinelle/free/devm_free.cocci |  4 ----
>  3 files changed, 27 deletions(-)
> 
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 877a95c6a2d2..03a389358562 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -184,7 +184,6 @@ void memcg_deactivate_kmem_caches(struct mem_cgroup *, struct mem_cgroup *);
>  /*
>   * Common kmalloc functions provided by all allocators
>   */
> -void * __must_check __krealloc(const void *, size_t, gfp_t);
>  void * __must_check krealloc(const void *, size_t, gfp_t);
>  void kfree(const void *);
>  void kzfree(const void *);
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index f0ab6d4ceb4c..87e8923cf0b6 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -1675,28 +1675,6 @@ static __always_inline void *__do_krealloc(const void *p, size_t new_size,
>  	return ret;
>  }
>  
> -/**
> - * __krealloc - like krealloc() but don't free @p.
> - * @p: object to reallocate memory for.
> - * @new_size: how many bytes of memory are required.
> - * @flags: the type of memory to allocate.
> - *
> - * This function is like krealloc() except it never frees the originally
> - * allocated buffer. Use this if you don't want to free the buffer immediately
> - * like, for example, with RCU.
> - *
> - * Return: pointer to the allocated memory or %NULL in case of error
> - */
> -void *__krealloc(const void *p, size_t new_size, gfp_t flags)
> -{
> -	if (unlikely(!new_size))
> -		return ZERO_SIZE_PTR;
> -
> -	return __do_krealloc(p, new_size, flags);
> -
> -}
> -EXPORT_SYMBOL(__krealloc);
> -
>  /**
>   * krealloc - reallocate memory. The contents will remain unchanged.
>   * @p: object to reallocate memory for.
> diff --git a/scripts/coccinelle/free/devm_free.cocci b/scripts/coccinelle/free/devm_free.cocci
> index 441799b5359b..66aaf68889a5 100644
> --- a/scripts/coccinelle/free/devm_free.cocci
> +++ b/scripts/coccinelle/free/devm_free.cocci
> @@ -94,8 +94,6 @@ position p;
>   kfree@p(x)
>  |
>   kzfree@p(x)
> -|
> - __krealloc@p(x, ...)
>  |
>   krealloc@p(x, ...)
>  |
> @@ -120,8 +118,6 @@ position p != safe.p;
>  |
>  * kzfree@p(x)
>  |
> -* __krealloc@p(x, ...)
> -|
>  * krealloc@p(x, ...)
>  |
>  * free_pages@p(x, ...)
> 

IMHO, __do_krealloc() changes can go into a separate patch.

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb


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

* Re: [PATCH] mm: remove __krealloc
  2019-12-12 23:18   ` Florian Westphal
@ 2019-12-13 18:59     ` David Rientjes
  0 siblings, 0 replies; 5+ messages in thread
From: David Rientjes @ 2019-12-13 18:59 UTC (permalink / raw)
  To: Florian Westphal
  Cc: linux-mm, cl, penberg, iamjoonsoo.kim, akpm, linux-kernel

On Fri, 13 Dec 2019, Florian Westphal wrote:

> > > Since 5.5-rc1 the last user of this function is gone, so remove the
> > > functionality.
> > > 
> > > See commit
> > > 2ad9d7747c10 ("netfilter: conntrack: free extension area immediately")
> > > for details.
> > > 
> > > Signed-off-by: Florian Westphal <fw@strlen.de>
> > 
> > So this also means that we can fold __do_krealloc() into krealloc()?
> 
> I would leave that to compiler but if you prefer this I can respin.
> 

Sure, no problem.

Acked-by: David Rientjes <rientjes@google.com>

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

end of thread, other threads:[~2019-12-13 20:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-12 22:34 [PATCH] mm: remove __krealloc Florian Westphal
2019-12-12 23:00 ` David Rientjes
2019-12-12 23:18   ` Florian Westphal
2019-12-13 18:59     ` David Rientjes
2019-12-13 10:17 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).