linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Add free() function
@ 2018-03-22 19:58 Matthew Wilcox
  2018-03-22 19:58 ` [PATCH 1/4] decompression: Rename malloc and free Matthew Wilcox
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Matthew Wilcox @ 2018-03-22 19:58 UTC (permalink / raw)
  To: linux-mm; +Cc: Kirill Tkhai, Matthew Wilcox, linux-kernel, Paul E. McKenney

From: Matthew Wilcox <mawilcox@microsoft.com>

Today, kfree_rcu() can only free objects allocated using kmalloc().
There have been attempts to extend that to kvfree(), but I think we
should take it even further and allow freeing as many different objects
as possible.

It turns out many different kinds of memory allocations can be detected
from the address.  vmalloc() and percpu_alloc() can be detected by being
in a particular range.  kmalloc() and kmem_cache_alloc() can be detected
from the struct page.  __get_free_pages() and page_frag_alloc() are both
freeable just by decrementing the refcount on the page.

This allows us to delete many dozens of tiny rcu callbacks throughout
the kernel, much as was done when kfree_rcu was added.

Matthew Wilcox (4):
  decompression: Rename malloc and free
  Rename 'free' functions
  mm: Add free()
  rcu: Switch to using free() instead of kfree()

 crypto/lrw.c                  |  4 ++--
 crypto/xts.c                  |  4 ++--
 include/linux/decompress/mm.h | 10 ++++++----
 include/linux/kernel.h        |  2 ++
 include/linux/rcupdate.h      | 40 +++++++++++++++++++---------------------
 include/linux/rcutiny.h       |  2 +-
 include/linux/rcutree.h       |  2 +-
 include/trace/events/rcu.h    |  8 ++++----
 kernel/rcu/rcu.h              |  8 +++-----
 kernel/rcu/tree.c             | 11 +++++------
 mm/util.c                     | 39 +++++++++++++++++++++++++++++++++++++++
 11 files changed, 84 insertions(+), 46 deletions(-)

-- 
2.16.2

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

end of thread, other threads:[~2018-04-03 11:41 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22 19:58 [PATCH 0/4] Add free() function Matthew Wilcox
2018-03-22 19:58 ` [PATCH 1/4] decompression: Rename malloc and free Matthew Wilcox
2018-03-22 19:58 ` [PATCH 2/4] Rename 'free' functions Matthew Wilcox
2018-03-22 19:58 ` [PATCH 3/4] mm: Add free() Matthew Wilcox
2018-03-23  8:04   ` Rasmus Villemoes
2018-03-23 14:34     ` Matthew Wilcox
2018-04-03  8:50       ` Pavel Machek
2018-04-03 11:41         ` Matthew Wilcox
2018-03-23 13:33   ` Kirill Tkhai
2018-03-23 15:14     ` Matthew Wilcox
2018-03-23 15:49       ` Kirill Tkhai
2018-03-23 16:15       ` Matthew Wilcox
2018-03-25 23:56       ` Matthew Wilcox
2018-03-24  7:38   ` kbuild test robot
2018-03-22 19:58 ` [PATCH 4/4] rcu: Switch to using free() instead of kfree() Matthew Wilcox
2018-03-24  7:07   ` kbuild test robot
2018-03-24  8:20   ` kbuild test robot

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).