Re: [PATCH 3/4] mm: Add free()

2018-04-03 Thread Matthew Wilcox
On Tue, Apr 03, 2018 at 10:50:59AM +0200, Pavel Machek wrote: > > gcc already does some nice optimisations around free(). For example, it > > can eliminate dead stores: > > Are we comfortable with that optimalization for kernel? > > us: "Hey, let's remove those encryption keys before freeing mem

Re: [PATCH 3/4] mm: Add free()

2018-04-03 Thread Pavel Machek
Hi! > > And sure, your free() implementation obviously also has that property, > > but I'm worried that they might one day decide to warn about the > > prototype mismatch (actually, I'm surprised it doesn't warn now, given > > that it obviously pretends to know what free() function I'm calling...)

Re: [PATCH 3/4] mm: Add free()

2018-03-25 Thread Matthew Wilcox
On Fri, Mar 23, 2018 at 08:14:21AM -0700, Matthew Wilcox wrote: > On Fri, Mar 23, 2018 at 04:33:24PM +0300, Kirill Tkhai wrote: > > > + page = virt_to_head_page(ptr); > > > + if (likely(PageSlab(page))) > > > + return kmem_cache_free(page->slab_cache, (void *)ptr); > > > > It seems slab_ca

Re: [PATCH 3/4] mm: Add free()

2018-03-24 Thread kbuild test robot
Hi Matthew, I love your patch! Yet something to improve: [auto build test ERROR on rcu/rcu/next] [also build test ERROR on v4.16-rc6 next-20180323] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commit

Re: [PATCH 3/4] mm: Add free()

2018-03-23 Thread Matthew Wilcox
On Fri, Mar 23, 2018 at 08:14:21AM -0700, Matthew Wilcox wrote: > > One more thing, there is > > some kasan checks on the main way of kfree(), and there is no guarantee they > > reflected in kmem_cache_free() identical. > > Which function are you talking about here? > > slub calls slab_free() for

Re: [PATCH 3/4] mm: Add free()

2018-03-23 Thread Kirill Tkhai
On 23.03.2018 18:14, Matthew Wilcox wrote: > On Fri, Mar 23, 2018 at 04:33:24PM +0300, Kirill Tkhai wrote: >>> + page = virt_to_head_page(ptr); >>> + if (likely(PageSlab(page))) >>> + return kmem_cache_free(page->slab_cache, (void *)ptr); >> >> It seems slab_cache is not generic for a

Re: [PATCH 3/4] mm: Add free()

2018-03-23 Thread Matthew Wilcox
On Fri, Mar 23, 2018 at 04:33:24PM +0300, Kirill Tkhai wrote: > > + page = virt_to_head_page(ptr); > > + if (likely(PageSlab(page))) > > + return kmem_cache_free(page->slab_cache, (void *)ptr); > > It seems slab_cache is not generic for all types of slabs. SLOB does not care > about

Re: [PATCH 3/4] mm: Add free()

2018-03-23 Thread Matthew Wilcox
On Fri, Mar 23, 2018 at 09:04:10AM +0100, Rasmus Villemoes wrote: > On 2018-03-22 20:58, Matthew Wilcox wrote: > > From: Matthew Wilcox > > > > free() can free many different kinds of memory. > > I'd be a bit worried about using that name. gcc very much knows about > the C standard's definition

Re: [PATCH 3/4] mm: Add free()

2018-03-23 Thread Kirill Tkhai
Hi, Matthew, On 22.03.2018 22:58, Matthew Wilcox wrote: > From: Matthew Wilcox > > free() can free many different kinds of memory. > > Signed-off-by: Matthew Wilcox > --- > include/linux/kernel.h | 2 ++ > mm/util.c | 39 +++ > 2 files changed

Re: [PATCH 3/4] mm: Add free()

2018-03-23 Thread Rasmus Villemoes
On 2018-03-22 20:58, Matthew Wilcox wrote: > From: Matthew Wilcox > > free() can free many different kinds of memory. I'd be a bit worried about using that name. gcc very much knows about the C standard's definition of that function, as can be seen on godbolt.org by compiling void free(const vo