Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-22 Thread Paul E. McKenney
On Wed, Feb 07, 2018 at 10:10:55AM -0800, Matthew Wilcox wrote: > On Wed, Feb 07, 2018 at 05:45:13PM +0100, Jesper Dangaard Brouer wrote: > > On Wed, 7 Feb 2018 08:57:00 -0500 > > Steven Rostedt wrote: > > > To me kvfree() is a special case and should not be used by RCU as a

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-22 Thread Paul E. McKenney
On Wed, Feb 07, 2018 at 10:10:55AM -0800, Matthew Wilcox wrote: > On Wed, Feb 07, 2018 at 05:45:13PM +0100, Jesper Dangaard Brouer wrote: > > On Wed, 7 Feb 2018 08:57:00 -0500 > > Steven Rostedt wrote: > > > To me kvfree() is a special case and should not be used by RCU as a > > > generic

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Paul E. McKenney
On Wed, Feb 07, 2018 at 01:26:19PM -0500, Steven Rostedt wrote: > On Wed, 7 Feb 2018 10:10:55 -0800 > Matthew Wilcox wrote: > > > > For the record, I fully agree with Steve here. > > Thanks, but... > > > > > > > And being a performance "fanatic" I don't like to have the

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Paul E. McKenney
On Wed, Feb 07, 2018 at 01:26:19PM -0500, Steven Rostedt wrote: > On Wed, 7 Feb 2018 10:10:55 -0800 > Matthew Wilcox wrote: > > > > For the record, I fully agree with Steve here. > > Thanks, but... > > > > > > > And being a performance "fanatic" I don't like to have the extra branch > > >

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Paul E. McKenney
On Wed, Feb 07, 2018 at 08:55:47AM -0600, Christopher Lameter wrote: > On Tue, 6 Feb 2018, Paul E. McKenney wrote: > > > So it is OK to kvmalloc() something and pass it to either kfree() or > > kvfree(), and it had better be OK to kvmalloc() something and pass it > > to kvfree(). > > kvfree() is

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Paul E. McKenney
On Wed, Feb 07, 2018 at 08:55:47AM -0600, Christopher Lameter wrote: > On Tue, 6 Feb 2018, Paul E. McKenney wrote: > > > So it is OK to kvmalloc() something and pass it to either kfree() or > > kvfree(), and it had better be OK to kvmalloc() something and pass it > > to kvfree(). > > kvfree() is

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Paul E. McKenney
On Wed, Feb 07, 2018 at 08:57:00AM -0500, Steven Rostedt wrote: > On Wed, 7 Feb 2018 00:31:04 -0800 > "Paul E. McKenney" wrote: > > > I see problems. We would then have two different names for exactly the > > same thing. > > > > Seems like it would be a lot easier

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Paul E. McKenney
On Wed, Feb 07, 2018 at 08:57:00AM -0500, Steven Rostedt wrote: > On Wed, 7 Feb 2018 00:31:04 -0800 > "Paul E. McKenney" wrote: > > > I see problems. We would then have two different names for exactly the > > same thing. > > > > Seems like it would be a lot easier to simply document the

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Steven Rostedt
On Wed, 7 Feb 2018 10:10:55 -0800 Matthew Wilcox wrote: > > For the record, I fully agree with Steve here. Thanks, but... > > > > And being a performance "fanatic" I don't like to have the extra branch > > (and compares) in the free code path... but it's a MM-decision

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Steven Rostedt
On Wed, 7 Feb 2018 10:10:55 -0800 Matthew Wilcox wrote: > > For the record, I fully agree with Steve here. Thanks, but... > > > > And being a performance "fanatic" I don't like to have the extra branch > > (and compares) in the free code path... but it's a MM-decision (and > > sometimes you

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Matthew Wilcox
On Wed, Feb 07, 2018 at 05:45:13PM +0100, Jesper Dangaard Brouer wrote: > On Wed, 7 Feb 2018 08:57:00 -0500 > Steven Rostedt wrote: > > To me kvfree() is a special case and should not be used by RCU as a > > generic function. That would make RCU and MM much more coupled than

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Matthew Wilcox
On Wed, Feb 07, 2018 at 05:45:13PM +0100, Jesper Dangaard Brouer wrote: > On Wed, 7 Feb 2018 08:57:00 -0500 > Steven Rostedt wrote: > > To me kvfree() is a special case and should not be used by RCU as a > > generic function. That would make RCU and MM much more coupled than > > necessary. > >

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Christopher Lameter
On Wed, 7 Feb 2018, Steven Rostedt wrote: > But a generic "malloc" or "free" that does things differently depending > on the size is a different story. They would not be used for cases with special requirements but for the throwaway allows where noone cares about these details. Its just a

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Christopher Lameter
On Wed, 7 Feb 2018, Steven Rostedt wrote: > But a generic "malloc" or "free" that does things differently depending > on the size is a different story. They would not be used for cases with special requirements but for the throwaway allows where noone cares about these details. Its just a

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Steven Rostedt
On Wed, 7 Feb 2018 09:19:36 -0800 Matthew Wilcox wrote: > > Please no, I hate subtle internal decisions like this. It makes > > debugging much more difficult, when allocating dynamic sized variables. > > When something works at one size but not the other. > > You know we

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Steven Rostedt
On Wed, 7 Feb 2018 09:19:36 -0800 Matthew Wilcox wrote: > > Please no, I hate subtle internal decisions like this. It makes > > debugging much more difficult, when allocating dynamic sized variables. > > When something works at one size but not the other. > > You know we already have

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Matthew Wilcox
On Wed, Feb 07, 2018 at 12:09:49PM -0500, Steven Rostedt wrote: > > Maybe lets implement malloc(), free() and realloc() in the kernel to be > > consistent with user space use as possible? Only use the others > > allocation variants for special cases. > > They would need to drop the GFP part and

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Matthew Wilcox
On Wed, Feb 07, 2018 at 12:09:49PM -0500, Steven Rostedt wrote: > > Maybe lets implement malloc(), free() and realloc() in the kernel to be > > consistent with user space use as possible? Only use the others > > allocation variants for special cases. > > They would need to drop the GFP part and

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Steven Rostedt
On Wed, 7 Feb 2018 10:47:02 -0600 (CST) Christopher Lameter wrote: > On Tue, 6 Feb 2018, Matthew Wilcox wrote: > > > Personally, I would like us to rename kvfree() to just free(), and have > > malloc(x) be an alias to kvmalloc(x, GFP_KERNEL), but I haven't won that > > fight

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Steven Rostedt
On Wed, 7 Feb 2018 10:47:02 -0600 (CST) Christopher Lameter wrote: > On Tue, 6 Feb 2018, Matthew Wilcox wrote: > > > Personally, I would like us to rename kvfree() to just free(), and have > > malloc(x) be an alias to kvmalloc(x, GFP_KERNEL), but I haven't won that > > fight yet. > > Maybe

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Christopher Lameter
On Tue, 6 Feb 2018, Matthew Wilcox wrote: > Personally, I would like us to rename kvfree() to just free(), and have > malloc(x) be an alias to kvmalloc(x, GFP_KERNEL), but I haven't won that > fight yet. Maybe lets implement malloc(), free() and realloc() in the kernel to be consistent with user

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Christopher Lameter
On Tue, 6 Feb 2018, Matthew Wilcox wrote: > Personally, I would like us to rename kvfree() to just free(), and have > malloc(x) be an alias to kvmalloc(x, GFP_KERNEL), but I haven't won that > fight yet. Maybe lets implement malloc(), free() and realloc() in the kernel to be consistent with user

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Jesper Dangaard Brouer
On Wed, 7 Feb 2018 08:57:00 -0500 Steven Rostedt wrote: > On Wed, 7 Feb 2018 00:31:04 -0800 > "Paul E. McKenney" wrote: > > > I see problems. We would then have two different names for exactly the > > same thing. > > > > Seems like it would be

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Jesper Dangaard Brouer
On Wed, 7 Feb 2018 08:57:00 -0500 Steven Rostedt wrote: > On Wed, 7 Feb 2018 00:31:04 -0800 > "Paul E. McKenney" wrote: > > > I see problems. We would then have two different names for exactly the > > same thing. > > > > Seems like it would be a lot easier to simply document the existing > >

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Steven Rostedt
On Wed, 7 Feb 2018 08:18:46 -0800 Matthew Wilcox wrote: > Do we need to be able to free any of those objects in order to rename > kfree_rcu() to just free_rcu()? I'm just nervous about tightly coupling free_rcu() with all the *free() from the memory management system. I've

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Steven Rostedt
On Wed, 7 Feb 2018 08:18:46 -0800 Matthew Wilcox wrote: > Do we need to be able to free any of those objects in order to rename > kfree_rcu() to just free_rcu()? I'm just nervous about tightly coupling free_rcu() with all the *free() from the memory management system. I've been burnt in the

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Matthew Wilcox
On Wed, Feb 07, 2018 at 08:57:00AM -0500, Steven Rostedt wrote: > On Wed, 7 Feb 2018 00:31:04 -0800 > "Paul E. McKenney" wrote: > > > I see problems. We would then have two different names for exactly the > > same thing. > > > > Seems like it would be a lot easier

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Matthew Wilcox
On Wed, Feb 07, 2018 at 08:57:00AM -0500, Steven Rostedt wrote: > On Wed, 7 Feb 2018 00:31:04 -0800 > "Paul E. McKenney" wrote: > > > I see problems. We would then have two different names for exactly the > > same thing. > > > > Seems like it would be a lot easier to simply document the

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Christopher Lameter
On Tue, 6 Feb 2018, Paul E. McKenney wrote: > So it is OK to kvmalloc() something and pass it to either kfree() or > kvfree(), and it had better be OK to kvmalloc() something and pass it > to kvfree(). kvfree() is fine but not kfree().

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Christopher Lameter
On Tue, 6 Feb 2018, Paul E. McKenney wrote: > So it is OK to kvmalloc() something and pass it to either kfree() or > kvfree(), and it had better be OK to kvmalloc() something and pass it > to kvfree(). kvfree() is fine but not kfree().

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Steven Rostedt
On Wed, 7 Feb 2018 00:31:04 -0800 "Paul E. McKenney" wrote: > I see problems. We would then have two different names for exactly the > same thing. > > Seems like it would be a lot easier to simply document the existing > kfree_rcu() behavior, especially given that

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Steven Rostedt
On Wed, 7 Feb 2018 00:31:04 -0800 "Paul E. McKenney" wrote: > I see problems. We would then have two different names for exactly the > same thing. > > Seems like it would be a lot easier to simply document the existing > kfree_rcu() behavior, especially given that it apparently already works.

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Paul E. McKenney
On Wed, Feb 07, 2018 at 10:57:28AM +0300, Kirill Tkhai wrote: > On 07.02.2018 08:02, Paul E. McKenney wrote: > > On Tue, Feb 06, 2018 at 08:23:34PM -0800, Matthew Wilcox wrote: > >> On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: > >>> So it is OK to kvmalloc() something and pass

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Paul E. McKenney
On Wed, Feb 07, 2018 at 10:57:28AM +0300, Kirill Tkhai wrote: > On 07.02.2018 08:02, Paul E. McKenney wrote: > > On Tue, Feb 06, 2018 at 08:23:34PM -0800, Matthew Wilcox wrote: > >> On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: > >>> So it is OK to kvmalloc() something and pass

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Paul E. McKenney
On Tue, Feb 06, 2018 at 11:54:09PM -0800, Josh Triplett wrote: > On Tue, Feb 06, 2018 at 09:02:00PM -0800, Paul E. McKenney wrote: > > On Tue, Feb 06, 2018 at 08:23:34PM -0800, Matthew Wilcox wrote: > > > On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: > > > > So it is OK to

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-07 Thread Paul E. McKenney
On Tue, Feb 06, 2018 at 11:54:09PM -0800, Josh Triplett wrote: > On Tue, Feb 06, 2018 at 09:02:00PM -0800, Paul E. McKenney wrote: > > On Tue, Feb 06, 2018 at 08:23:34PM -0800, Matthew Wilcox wrote: > > > On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: > > > > So it is OK to

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Kirill Tkhai
On 07.02.2018 08:02, Paul E. McKenney wrote: > On Tue, Feb 06, 2018 at 08:23:34PM -0800, Matthew Wilcox wrote: >> On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: >>> So it is OK to kvmalloc() something and pass it to either kfree() or >>> kvfree(), and it had better be OK to

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Kirill Tkhai
On 07.02.2018 08:02, Paul E. McKenney wrote: > On Tue, Feb 06, 2018 at 08:23:34PM -0800, Matthew Wilcox wrote: >> On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: >>> So it is OK to kvmalloc() something and pass it to either kfree() or >>> kvfree(), and it had better be OK to

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Josh Triplett
On Tue, Feb 06, 2018 at 09:02:00PM -0800, Paul E. McKenney wrote: > On Tue, Feb 06, 2018 at 08:23:34PM -0800, Matthew Wilcox wrote: > > On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: > > > So it is OK to kvmalloc() something and pass it to either kfree() or > > > kvfree(), and

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Josh Triplett
On Tue, Feb 06, 2018 at 09:02:00PM -0800, Paul E. McKenney wrote: > On Tue, Feb 06, 2018 at 08:23:34PM -0800, Matthew Wilcox wrote: > > On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: > > > So it is OK to kvmalloc() something and pass it to either kfree() or > > > kvfree(), and

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Paul E. McKenney
On Tue, Feb 06, 2018 at 08:23:34PM -0800, Matthew Wilcox wrote: > On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: > > So it is OK to kvmalloc() something and pass it to either kfree() or > > kvfree(), and it had better be OK to kvmalloc() something and pass it > > to kvfree(). >

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Paul E. McKenney
On Tue, Feb 06, 2018 at 08:23:34PM -0800, Matthew Wilcox wrote: > On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: > > So it is OK to kvmalloc() something and pass it to either kfree() or > > kvfree(), and it had better be OK to kvmalloc() something and pass it > > to kvfree(). >

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Matthew Wilcox
On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: > So it is OK to kvmalloc() something and pass it to either kfree() or > kvfree(), and it had better be OK to kvmalloc() something and pass it > to kvfree(). > > Is it OK to kmalloc() something and pass it to kvfree()? Yes, it

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Matthew Wilcox
On Tue, Feb 06, 2018 at 06:17:03PM -0800, Paul E. McKenney wrote: > So it is OK to kvmalloc() something and pass it to either kfree() or > kvfree(), and it had better be OK to kvmalloc() something and pass it > to kvfree(). > > Is it OK to kmalloc() something and pass it to kvfree()? Yes, it

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Paul E. McKenney
On Tue, Feb 06, 2018 at 01:19:29PM +0300, Kirill Tkhai wrote: > Recent times kvmalloc() begun widely be used in kernel. > Some of such memory allocations have to be freed after > rcu grace period, and this patchset introduces a generic > primitive for doing this. > > Actually, everything is made

Re: [PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Paul E. McKenney
On Tue, Feb 06, 2018 at 01:19:29PM +0300, Kirill Tkhai wrote: > Recent times kvmalloc() begun widely be used in kernel. > Some of such memory allocations have to be freed after > rcu grace period, and this patchset introduces a generic > primitive for doing this. > > Actually, everything is made

[PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Kirill Tkhai
Recent times kvmalloc() begun widely be used in kernel. Some of such memory allocations have to be freed after rcu grace period, and this patchset introduces a generic primitive for doing this. Actually, everything is made in [1/2]. Patch [2/2] is just added to make new kvfree_rcu() have the

[PATCH 0/2] rcu: Transform kfree_rcu() into kvfree_rcu()

2018-02-06 Thread Kirill Tkhai
Recent times kvmalloc() begun widely be used in kernel. Some of such memory allocations have to be freed after rcu grace period, and this patchset introduces a generic primitive for doing this. Actually, everything is made in [1/2]. Patch [2/2] is just added to make new kvfree_rcu() have the