Re: [PATCH v2 09/16] rcu/tree: Maintain separate array for vmalloc ptrs

2020-06-18 Thread Uladzislau Rezki
> > > > I don't think that replacing direct function calls with indirect function > > calls is a great suggestion with the current state of play around branch > > prediction. > > > > I'd suggest: > > > > rcu_lock_acquire(_callback_map); > >

Re: [PATCH v2 09/16] rcu/tree: Maintain separate array for vmalloc ptrs

2020-06-18 Thread Uladzislau Rezki
> > > > Not an emergency, but did you look into replacing this "if" statement > > with an array of pointers to functions implementing the legs of the > > "if" statement? If nothing else, this would greatly reduced indentation. > > I don't think that replacing direct function calls with indirect

Re: [PATCH v2 09/16] rcu/tree: Maintain separate array for vmalloc ptrs

2020-06-18 Thread Uladzislau Rezki
> > + // Handle two first channels. > > + for (i = 0; i < FREE_N_CHANNELS; i++) { > > + for (; bkvhead[i]; bkvhead[i] = bnext) { > > + bnext = bkvhead[i]->next; > > + debug_rcu_bhead_unqueue(bkvhead[i]); > > + > > +

Re: [mm/vmalloc] 0acd9a0ded: kernel_BUG_at_mm/vmalloc.c

2020-06-15 Thread Uladzislau Rezki
Hello, Ingo. > > Greeting, > > > > FYI, we noticed the following commit (built with gcc-9): > > > > commit: 0acd9a0ded80c986ccc9588ba2703436769ead74 ("Revert "mm/vmalloc: > > modify struct vmap_area to reduce its size"") > > https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git WIP.fixes >

Re: [PATCH] rcu: Stop shrinker loop

2020-06-04 Thread Uladzislau Rezki
> On Thu, Jun 04, 2020 at 03:42:55PM +0200, Uladzislau Rezki wrote: > > On Thu, Jun 04, 2020 at 12:23:20PM +0200, Peter Enderborg wrote: > > > The count and scan can be separated in time. It is a fair chance > > > that all work is already done when the scan starts

Re: [PATCH] rcu: Stop shrinker loop

2020-06-04 Thread Uladzislau Rezki
7 @@ kfree_rcu_shrink_scan(struct shrinker *shrink, struct > shrink_control *sc) > break; > } > > - return freed; > + return freed == 0 ? SHRINK_STOP : freed; > } > The loop will be stopped anyway sooner or later, but sooner is better :) T

[PATCH 2/3] mm/vmalloc: simplify augment_tree_propagate_check() func.

2020-05-27 Thread Uladzislau Rezki (Sony)
from bottom to upper levels using a regular list instead, because nodes are linked among each other also. It is faster and without recursion. Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 42 -- 1 file changed, 8 insertions(+), 34 deletions

[PATCH 3/3] mm/vmalloc: switch to "propagate()" callback

2020-05-27 Thread Uladzislau Rezki (Sony)
unctions does not make sense and is redundant. Reuse "built in" functionality to the macros. So the code size gets reduced. Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 25 ++--- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/mm/vmalloc

[PATCH 1/3] mm/vmalloc: simplify merge_or_add_vmap_area() func.

2020-05-27 Thread Uladzislau Rezki (Sony)
in fact. Therefore do it only once when VA points to final merged area, after all manipulations: merging/removing/inserting. Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/mm/vmalloc.c b/mm

[PATCH v2 04/16] rcu/tree: Make debug_objects logic independent of rcu_head

2020-05-25 Thread Uladzislau Rezki (Sony)
From: "Joel Fernandes (Google)" kfree_rcu()'s debug_objects logic uses the address of the object's embedded rcu_head to queue/unqueue. Instead of this, make use of the object's address itself as preparation for future headless kfree_rcu() support. Reviewed-by: Uladzislau Rezki

[PATCH v2 07/16] rcu/tree: Use static initializer for krc.lock

2020-05-25 Thread Uladzislau Rezki (Sony)
remove the '->initialized' check. Cc: Sebastian Andrzej Siewior Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index c1f

[PATCH v2 03/16] rcu/tree: Repeat the monitor if any free channel is busy

2020-05-25 Thread Uladzislau Rezki (Sony)
if there are any channels in the pending state after a detach attempt. Fixes: 34c881745549e ("rcu: Support kfree_bulk() interface in kfree_rcu()") Acked-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 9 ++--- 1 file changed, 6 insertions(+), 3

[PATCH v2 12/16] mm/list_lru.c: Rename kvfree_rcu() to local variant

2020-05-25 Thread Uladzislau Rezki (Sony)
Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Joel Fernandes (Google) Signed-off-by: Joel Fernandes (Google) --- mm/list_lru.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/list_lru.c b/mm/list_lru.c index 4d5294c39bba..42c95bcb53ca 100644 --- a/mm/list_lru.c

[PATCH v2 08/16] rcu/tree: cache specified number of objects

2020-05-25 Thread Uladzislau Rezki (Sony)
pages per CPU. Signed-off-by: Uladzislau Rezki (Sony) --- .../admin-guide/kernel-parameters.txt | 8 +++ kernel/rcu/tree.c | 66 +-- 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b

[PATCH v2 09/16] rcu/tree: Maintain separate array for vmalloc ptrs

2020-05-25 Thread Uladzislau Rezki (Sony)
for the right kind of pointer. It also prepares us for future headless support for vmalloc and SLAB objects. Such objects cannot be queued on a linked list and are instead directly into an array. Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Joel Fernandes (Google) Reviewed-by: Joel

[PATCH v2 14/16] rcu: Support reclaim for head-less object

2020-05-25 Thread Uladzislau Rezki (Sony)
a synchronize_rcu() call. Note that for tiny-RCU, any call to synchronize_rcu() is actually a quiescent state, therefore it does nothing. Reviewed-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Joel Fernandes (Google) Co-developed-by: Joel Fernandes (Google) --- include

[PATCH v2 05/16] rcu/tree: Simplify KFREE_BULK_MAX_ENTR macro

2020-05-25 Thread Uladzislau Rezki (Sony)
We can simplify KFREE_BULK_MAX_ENTR macro and get rid of magic numbers which were used to make the structure to be exactly one page. Suggested-by: Boqun Feng Reviewed-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Joel Fernandes (Google) --- kernel/rcu

[PATCH v2 11/16] rcu: Rename *_kfree_callback/*_kfree_rcu_offset/kfree_call_*

2020-05-25 Thread Uladzislau Rezki (Sony)
. Reviewed-by: Joel Fernandes (Google) Co-developed-by: Joel Fernandes (Google) Signed-off-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- include/linux/rcupdate.h | 14 +++--- include/linux/rcutiny.h| 2 +- include/linux/rcutree.h| 2 +- include/trace/events

[PATCH v2 06/16] rcu/tree: Move kfree_rcu_cpu locking/unlocking to separate functions

2020-05-25 Thread Uladzislau Rezki (Sony)
Introduce helpers to lock and unlock per-cpu "kfree_rcu_cpu" structures. That will make kfree_call_rcu() more readable and prevent programming errors. Reviewed-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 31 +++--

[PATCH v2 00/16] Introduce kvfree_rcu(1 or 2 arguments)

2020-05-25 Thread Uladzislau Rezki (Sony)
le) (3): rcu/tree: Keep kfree_rcu() awake during lock contention rcu/tree: Skip entry into the page allocator for PREEMPT_RT rcu/tree: Make debug_objects logic independent of rcu_head Sebastian Andrzej Siewior (1): rcu/tree: Use static initializer for krc.lock Uladzislau Rezki (Sony) (12):

[PATCH v2 10/16] rcu/tiny: support vmalloc in tiny-RCU

2020-05-25 Thread Uladzislau Rezki (Sony)
Replace kfree() with kvfree() in rcu_reclaim_tiny(). This makes it possible to release either SLAB or vmalloc objects after a GP. Reviewed-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tiny.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[PATCH v2 16/16] lib/test_vmalloc.c: Add test cases for kvfree_rcu()

2020-05-25 Thread Uladzislau Rezki (Sony)
throughput. Reviewed-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- lib/test_vmalloc.c | 103 + 1 file changed, 95 insertions(+), 8 deletions(-) diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c index 8bbefcaddfe8

[PATCH v2 15/16] rcu: Introduce single argument kvfree_rcu() interface

2020-05-25 Thread Uladzislau Rezki (Sony)
(ptr); Note that the headless usage (example b) can only be used in a code that can sleep. This is enforced by the CONFIG_DEBUG_ATOMIC_SLEEP option. Co-developed-by: Joel Fernandes (Google) Reviewed-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- include/linux/rcupdate.h

[PATCH v2 13/16] rcu: Introduce 2 arg kvfree_rcu() interface

2020-05-25 Thread Uladzislau Rezki (Sony)
of object. struct test_kvfree_rcu { struct rcu_head rcu; unsigned char array[100]; }; struct test_kvfree_rcu *p; p = kvmalloc(10 * PAGE_SIZE); if (p) kvfree_rcu(p, rcu); Signed-off-by: Uladzislau Rezki (Sony) Co-developed-by: Joel Fernandes (Google

[PATCH v2 02/16] rcu/tree: Skip entry into the page allocator for PREEMPT_RT

2020-05-25 Thread Uladzislau Rezki (Sony)
st place. Cc: Sebastian Andrzej Siewior Reviewed-by: Uladzislau Rezki Co-developed-by: Uladzislau Rezki Signed-off-by: Uladzislau Rezki Signed-off-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 12 1 file changed, 12 insertions(+

[PATCH v2 01/16] rcu/tree: Keep kfree_rcu() awake during lock contention

2020-05-25 Thread Uladzislau Rezki (Sony)
converting the spinlock to a raw spinlock. Vetting all code paths, there is no reason to believe that the raw spinlock will hurt RT latencies as it is not held for a long time. Cc: bige...@linutronix.de Cc: Uladzislau Rezki Reviewed-by: Uladzislau Rezki Signed-off-by: Joel Fernandes (Google)

Re: [PATCH 3/8] srcu: Use local_lock() for per-CPU struct srcu_data access

2020-05-20 Thread Uladzislau Rezki
> > I actually found it in RT 4.4 kernel, I thought this was also on newer RT > kernels as well (is that not true anymore?). But yes it was exactly what > Peter said. > I see it also in 5.6.4 linut-rt-devel: #ifdef CONFIG_PREEMPT_RT ... # define get_local_ptr(var) ({ \ migrate_disable(); \

Re: [PATCH 21/24] rcu/tiny: move kvfree_call_rcu() out of header

2020-05-07 Thread Uladzislau Rezki
> > > > Please see full log here: > > ftp://vps418301.ovh.net/incoming/include_mm_h_output.txt > > > > I can fix it by adding the kvfree() declaration to the rcutiny.h also: > > extern void kvfree(const void *addr); > > > > what seems wired to me? Also it can be fixed if i move it to the

Re: [PATCH 21/24] rcu/tiny: move kvfree_call_rcu() out of header

2020-05-06 Thread Uladzislau Rezki
Hello, Paul, Joel. > > Move inlined kvfree_call_rcu() function out of the > > header file. This step is a preparation for head-less > > support. > > > > Reviewed-by: Joel Fernandes (Google) > > Signed-off-by: Uladzislau Rezki (Sony) > > --- > >

Re: [PATCH RFC] rcu/tree: Refactor object allocation and try harder for array allocation

2020-05-05 Thread Uladzislau Rezki
> > b) Double argument(with rcu_head) > > This case we consider as it gets called from atomic context even though > > it can be not. Why we consider such case as atomic: we just assume that. > > The reason is to keep it simple, because it is not possible to detect > > whether > > a current

Re: [PATCH 09/24] rcu/tree: cache specified number of objects

2020-05-05 Thread Uladzislau Rezki
On Mon, May 04, 2020 at 01:16:41PM -0700, Paul E. McKenney wrote: > On Mon, May 04, 2020 at 09:51:28PM +0200, Uladzislau Rezki wrote: > > > > > Since we don't care about traversing backwards, isn't it better to > > > > > use llist > > > > > fo

Re: [PATCH 09/24] rcu/tree: cache specified number of objects

2020-05-04 Thread Uladzislau Rezki
> > > Since we don't care about traversing backwards, isn't it better to use > > > llist > > > for this usecase? > > > > > > I think Vlad is using locking as we're also tracking the size of the > > > llist to > > > know when to free pages. This tracking could suffer from the lost-update > > >

Re: [PATCH 09/24] rcu/tree: cache specified number of objects

2020-05-04 Thread Uladzislau Rezki
On Mon, May 04, 2020 at 08:24:37AM -0700, Paul E. McKenney wrote: > On Mon, May 04, 2020 at 02:43:23PM +0200, Uladzislau Rezki wrote: > > On Fri, May 01, 2020 at 02:27:49PM -0700, Paul E. McKenney wrote: > > > On Tue, Apr 28, 2020 at 10:58:48PM +0200, Uladzislau Rezki (Sony) wr

Re: [PATCH 19/24] rcu/tree: Support reclaim for head-less object

2020-05-04 Thread Uladzislau Rezki
> > > > For single argument we can drop the lock before the entry to the page > > allocator. Because it follows might_sleep() anotation we avoid of having > > a situation when spinlock(rt mutex) is taken from any atomic context. > > > > Since the lock is dropped the current context can be

Re: [PATCH 11/24] rcu/tree: Maintain separate array for vmalloc ptrs

2020-05-04 Thread Uladzislau Rezki
> > @@ -3072,21 +3105,34 @@ static inline bool queue_kfree_rcu_work(struct > > kfree_rcu_cpu *krcp) > > krwp = &(krcp->krw_arr[i]); > > > > /* > > -* Try to detach bhead or head and attach it over any > > +* Try to detach bkvhead or head and

Re: [PATCH 19/24] rcu/tree: Support reclaim for head-less object

2020-05-04 Thread Uladzislau Rezki
> > > > > > If we are not doing single-pointer allocation, then that would also > > > eliminate > > > entering the low-level page allocator for single-pointer allocations. > > > > > > Or did you mean entry into the allocator for the full-page allocations > > > related to the pointer array for

Re: [PATCH 19/24] rcu/tree: Support reclaim for head-less object

2020-05-04 Thread Uladzislau Rezki
On Fri, May 01, 2020 at 03:39:09PM -0700, Paul E. McKenney wrote: > On Tue, Apr 28, 2020 at 10:58:58PM +0200, Uladzislau Rezki (Sony) wrote: > > Update the kvfree_call_rcu() with head-less support, it > > means an object without any rcu_head structure can be > &g

Re: [PATCH 20/24] rcu/tree: Make kvfree_rcu() tolerate any alignment

2020-05-04 Thread Uladzislau Rezki
> > > On Tue, Apr 28, 2020 at 10:58:59PM +0200, Uladzislau Rezki (Sony) wrote: > > > > > From: "Joel Fernandes (Google)" > > > > > > > > > > Handle cases where the the object being kvfree_rcu()'d is not aligned > > >

Re: [PATCH 22/24] rcu/tiny: support reclaim for head-less object

2020-05-04 Thread Uladzislau Rezki
On Sun, May 03, 2020 at 08:27:00PM -0400, Joel Fernandes wrote: > On Fri, May 01, 2020 at 04:06:38PM -0700, Paul E. McKenney wrote: > > On Tue, Apr 28, 2020 at 10:59:01PM +0200, Uladzislau Rezki (Sony) wrote: > > > Make a kvfree_call_rcu() function to support head-less &

Re: [PATCH 21/24] rcu/tiny: move kvfree_call_rcu() out of header

2020-05-04 Thread Uladzislau Rezki
On Fri, May 01, 2020 at 04:03:59PM -0700, Paul E. McKenney wrote: > On Tue, Apr 28, 2020 at 10:59:00PM +0200, Uladzislau Rezki (Sony) wrote: > > Move inlined kvfree_call_rcu() function out of the > > header file. This step is a preparation for head-less > > support. >

Re: [PATCH 10/24] rcu/tree: add rcutree.rcu_min_cached_objs description

2020-05-04 Thread Uladzislau Rezki
On Fri, May 01, 2020 at 03:25:24PM -0700, Paul E. McKenney wrote: > On Tue, Apr 28, 2020 at 10:58:49PM +0200, Uladzislau Rezki (Sony) wrote: > > Document the rcutree.rcu_min_cached_objs sysfs kernel parameter. > > > > Signed-off-by: Uladzislau Rezki (Sony) > > Could y

Re: [PATCH 09/24] rcu/tree: cache specified number of objects

2020-05-04 Thread Uladzislau Rezki
On Fri, May 01, 2020 at 02:27:49PM -0700, Paul E. McKenney wrote: > On Tue, Apr 28, 2020 at 10:58:48PM +0200, Uladzislau Rezki (Sony) wrote: > > Cache some extra objects per-CPU. During reclaim process > > some pages are cached instead of releasing by linking them > > into th

Re: [PATCH 08/24] rcu/tree: Use static initializer for krc.lock

2020-05-04 Thread Uladzislau Rezki
> > > > - local_irq_save(*flags); // For safely calling this_cpu_ptr(). > > + local_irq_save(*flags); /* For safely calling this_cpu_ptr(). */ > > And here as well. ;-) > OK. For me it works either way. I can stick to "//" :) -- Vlad Rezki

[PATCH 07/24] rcu/tree: move locking/unlocking to separate functions

2020-04-28 Thread Uladzislau Rezki (Sony)
Introduce two helpers to lock and unlock an access to the per-cpu "kfree_rcu_cpu" structure. The reason is to make kfree_call_rcu() function to be more readable. Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 31 +++ 1 file changed, 23

[PATCH 01/24] rcu/tree: Keep kfree_rcu() awake during lock contention

2020-04-28 Thread Uladzislau Rezki (Sony)
ot subject to such conversions. Vetting all code paths, there is no reason to believe that the raw spinlock will be held for long time so PREEMPT_RT should not suffer from lengthy acquirals of the lock. Cc: bige...@linutronix.de Cc: Uladzislau Rezki Reviewed-by: Uladzislau Rezki Signed-off-by: Joel

[PATCH 08/24] rcu/tree: Use static initializer for krc.lock

2020-04-28 Thread Uladzislau Rezki (Sony)
remove the '->initialized' check. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index bc6c2bc8fa32..89e9ca3f4e3e 100644 --- a/k

[PATCH 06/24] rcu/tree: Simplify KFREE_BULK_MAX_ENTR macro

2020-04-28 Thread Uladzislau Rezki (Sony)
We can simplify KFREE_BULK_MAX_ENTR macro and get rid of magic numbers which were used to make the structure to be exactly one page. Suggested-by: Boqun Feng Reviewed-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Joel Fernandes (Google) --- kernel/rcu

[PATCH 03/24] rcu/tree: Use consistent style for comments

2020-04-28 Thread Uladzislau Rezki (Sony)
From: "Joel Fernandes (Google)" Simple clean up of comments in kfree_rcu() code to keep it consistent with majority of commenting styles. Reviewed-by: Uladzislau Rezki Signed-off-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/t

[PATCH 23/24] rcu: Introduce 1 arg kvfree_rcu() interface

2020-04-28 Thread Uladzislau Rezki (Sony)
) Signed-off-by: Uladzislau Rezki (Sony) --- include/linux/rcupdate.h | 38 ++ 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 51b26ab02878..d15d46db61f7 100644 --- a/include/linux/rcupdate.h

[PATCH 12/24] rcu/tiny: support vmalloc in tiny-RCU

2020-04-28 Thread Uladzislau Rezki (Sony)
Replace kfree() with kvfree() in rcu_reclaim_tiny(). So it becomes possible to release either SLAB memory or vmalloc one after a GP. Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tiny.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tiny.c b/kernel/rcu

[PATCH 17/24] rcu: Introduce 2 arg kvfree_rcu() interface

2020-04-28 Thread Uladzislau Rezki (Sony)
kvfree_rcu { struct rcu_head rcu; unsigned char array[100]; }; struct test_kvfree_rcu *p; p = kvmalloc(10 * PAGE_SIZE); if (p) kvfree_rcu(p, rcu); Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Joel Fernandes (Google) Signed-off-by: Joel Fernand

[PATCH 04/24] rcu/tree: Repeat the monitor if any free channel is busy

2020-04-28 Thread Uladzislau Rezki (Sony)
in pending state after a detach attempt, just reschedule the monitor work. Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 1487af8e11e8..0762ac06f0b7 100644 --- a/kernel

[PATCH 14/24] rcu: Rename __is_kfree_rcu_offset() macro

2020-04-28 Thread Uladzislau Rezki (Sony)
Rename __is_kfree_rcu_offset to __is_kvfree_rcu_offset. All RCU paths use kvfree() now instead of kfree(), thus rename it. Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Joel Fernandes (Google) Signed-off-by: Joel Fernandes (Google) --- include/linux/rcupdate.h | 6 +++--- kernel/rcu

[PATCH 09/24] rcu/tree: cache specified number of objects

2020-04-28 Thread Uladzislau Rezki (Sony)
occurs. A parameter reflecting the minimum allowed pages to be cached per one CPU is propagated via sysfs, it is read only, the name is "rcu_min_cached_objs". Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 64 --- 1 file c

[PATCH 16/24] mm/list_lru.c: Rename kvfree_rcu() to local variant

2020-04-28 Thread Uladzislau Rezki (Sony)
Rename kvfree_rcu() function to the kvfree_rcu_local() one. The aim is to introduce the public API that would conflict with this one. So we temporarily rename it and remove it in a later commit. Cc: linux...@kvack.org Cc: Andrew Morton Cc: r...@vger.kernel.org Signed-off-by: Uladzislau Rezki

[PATCH 22/24] rcu/tiny: support reclaim for head-less object

2020-04-28 Thread Uladzislau Rezki (Sony)
. Also please note that for tiny-RCU any call of synchronize_rcu() is actually a quiescent state, therefore (a) does nothing. Reviewed-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tiny.c | 157 +- 1 file changed, 156

[PATCH 10/24] rcu/tree: add rcutree.rcu_min_cached_objs description

2020-04-28 Thread Uladzislau Rezki (Sony)
Document the rcutree.rcu_min_cached_objs sysfs kernel parameter. Signed-off-by: Uladzislau Rezki (Sony) --- Documentation/admin-guide/kernel-parameters.txt | 8 1 file changed, 8 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide

[PATCH 02/24] rcu/tree: Skip entry into the page allocator for PREEMPT_RT

2020-04-28 Thread Uladzislau Rezki (Sony)
Cc: Sebastian Andrzej Siewior Reviewed-by: Uladzislau Rezki Co-developed-by: Uladzislau Rezki Signed-off-by: Uladzislau Rezki Signed-off-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 12 1 file changed, 12 insertions(+) diff --git

[PATCH 05/24] rcu/tree: Simplify debug_objects handling

2020-04-28 Thread Uladzislau Rezki (Sony)
From: "Joel Fernandes (Google)" In order to prepare for future changes for headless RCU support, make the debug_objects handling in kfree_rcu use the final 'pointer' value of the object, instead of depending on the head. Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Joel

[PATCH 19/24] rcu/tree: Support reclaim for head-less object

2020-04-28 Thread Uladzislau Rezki (Sony)
steps could be applied: a) wait until a grace period has elapsed; b) direct inlining of the kvfree() call. Reviewed-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Joel Fernandes (Google) Co-developed-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 102

[PATCH 00/24] Introduce kvfree_rcu(1 or 2 arguments)

2020-04-28 Thread Uladzislau Rezki (Sony)
try into the page allocator for PREEMPT_RT rcu/tree: Use consistent style for comments rcu/tree: Simplify debug_objects handling rcu/tree: Make kvfree_rcu() tolerate any alignment Sebastian Andrzej Siewior (1): rcu/tree: Use static initializer for krc.lock Uladzislau Rezki (Sony) (18):

[PATCH 15/24] rcu: Rename kfree_call_rcu() to the kvfree_call_rcu().

2020-04-28 Thread Uladzislau Rezki (Sony)
The reason is, it is capable of freeing vmalloc() memory now. Do the same with __kfree_rcu() macro, it becomes __kvfree_rcu(), the reason is the same as pointed above. Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Joel Fernandes (Google) Signed-off-by: Joel Fernandes (Google

[PATCH 18/24] mm/list_lru.c: Remove kvfree_rcu_local() function

2020-04-28 Thread Uladzislau Rezki (Sony)
Morton Cc: r...@vger.kernel.org Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Joel Fernandes (Google) Signed-off-by: Joel Fernandes (Google) --- mm/list_lru.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/mm/list_lru.c b/mm/list_lru.c index

[PATCH 20/24] rcu/tree: Make kvfree_rcu() tolerate any alignment

2020-04-28 Thread Uladzislau Rezki (Sony)
From: "Joel Fernandes (Google)" Handle cases where the the object being kvfree_rcu()'d is not aligned by 2-byte boundaries. Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletion

[PATCH 21/24] rcu/tiny: move kvfree_call_rcu() out of header

2020-04-28 Thread Uladzislau Rezki (Sony)
Move inlined kvfree_call_rcu() function out of the header file. This step is a preparation for head-less support. Reviewed-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- include/linux/rcutiny.h | 6 +- kernel/rcu/tiny.c | 6 ++ 2 files changed, 7

[PATCH 24/24] lib/test_vmalloc.c: Add test cases for kvfree_rcu()

2020-04-28 Thread Uladzislau Rezki (Sony)
of the performance throughput and its impact. Signed-off-by: Uladzislau Rezki (Sony) --- lib/test_vmalloc.c | 103 + 1 file changed, 95 insertions(+), 8 deletions(-) diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c index 8bbefcaddfe8..ec73561cda2e

[PATCH 13/24] rcu: Rename rcu_invoke_kfree_callback/rcu_kfree_callback

2020-04-28 Thread Uladzislau Rezki (Sony)
Rename rcu_invoke_kfree_callback to rcu_invoke_kvfree_callback. Do the same with second trace event, the rcu_kfree_callback, becomes rcu_kvfree_callback. The reason is to be aligned with kvfree notation. Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Joel Fernandes (Google) Signed-off

[PATCH 11/24] rcu/tree: Maintain separate array for vmalloc ptrs

2020-04-28 Thread Uladzislau Rezki (Sony)
the preparation patch for head-less objects support. When an object is head-less we can not queue it into any list, instead a pointer is placed directly into an array. Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Joel Fernandes (Google) Reviewed-by: Joel Fernandes (Google) Co-developed

[PATCH 1/1] mm/vmalloc: rework vmap_area_lock

2019-10-22 Thread Uladzislau Rezki (Sony)
[ 305.108944] All test took CPU4=297630721 cycles [ 305.196406] All test took CPU5=297548736 cycles [ 305.288602] All test took CPU6=297092392 cycles [ 305.381088] All test took CPU7=297293597 cycles ~14%-23% patched variant is better. Signed-off-b

Re: [PATCH v3 2/3] mm/vmalloc: respect passed gfp_mask when do preloading

2019-10-19 Thread Uladzislau Rezki
> > > > > > This is explaining what but it doesn't say why. I would go with > > > " > > > Allocation functions should comply with the given gfp_mask as much as > > > possible. The preallocation code in alloc_vmap_area doesn't follow that > > > pattern and it is using a hardcoded GFP_KERNEL.

Re: [PATCH v3 2/3] mm/vmalloc: respect passed gfp_mask when do preloading

2019-10-18 Thread Uladzislau Rezki
> > alloc_vmap_area() is given a gfp_mask for the page allocator. > > Let's respect that mask and consider it even in the case when > > doing regular CPU preloading, i.e. where a context can sleep. > > This is explaining what but it doesn't say why. I would go with > " > Allocation functions

Re: [PATCH v3 3/3] mm/vmalloc: add more comments to the adjust_va_to_fit_type()

2019-10-18 Thread Uladzislau Rezki
On Wed, Oct 16, 2019 at 01:07:22PM +0200, Michal Hocko wrote: > On Wed 16-10-19 11:54:38, Uladzislau Rezki (Sony) wrote: > > When fit type is NE_FIT_TYPE there is a need in one extra object. > > Usually the "ne_fit_preload_node" per-CPU variable has it and > >

Re: [PATCH v3 1/3] mm/vmalloc: remove preempt_disable/enable when do preloading

2019-10-18 Thread Uladzislau Rezki
Hello, Michal. Sorry for late reply. See my comments enclosed below: > On Wed 16-10-19 11:54:36, Uladzislau Rezki (Sony) wrote: > > Some background. The preemption was disabled before to guarantee > > that a preloaded object is available for a CPU, it was stored for. >

[PATCH v3 3/3] mm/vmalloc: add more comments to the adjust_va_to_fit_type()

2019-10-16 Thread Uladzislau Rezki (Sony)
hen it can occur, how often, under which conditions and what happens if GFP_NOWAIT gets failed. Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 13 + 1 file changed, 13 insertions(+) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 593bf554518d..2290a0d270e4 100644 --- a/mm

[PATCH v3 1/3] mm/vmalloc: remove preempt_disable/enable when do preloading

2019-10-16 Thread Uladzislau Rezki (Sony)
one object for split purpose") Reviewed-by: Steven Rostedt (VMware) Acked-by: Sebastian Andrzej Siewior Acked-by: Daniel Wagner Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 37 - 1 file changed, 20 insertions(+), 17 deletions(-) diff

[PATCH v3 2/3] mm/vmalloc: respect passed gfp_mask when do preloading

2019-10-16 Thread Uladzislau Rezki (Sony)
alloc_vmap_area() is given a gfp_mask for the page allocator. Let's respect that mask and consider it even in the case when doing regular CPU preloading, i.e. where a context can sleep. Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 8 1 file changed, 4 insertions(+), 4

Re: [PATCH 1/1] mm/vmalloc: remove preempt_disable/enable when do preloading

2019-10-15 Thread Uladzislau Rezki
> > > > > > :* The preload is done in non-atomic context, thus it allows us > > > > > > :* to use more permissive allocation masks to be more stable > > > > > > under > > > > > > :* low memory condition and high memory pressure. > > > > > > :* > > > > > > :* Even if it fails

Re: [PATCH v2 1/1] mm/vmalloc: remove preempt_disable/enable when do preloading

2019-10-14 Thread Uladzislau Rezki
On Mon, Oct 14, 2019 at 03:13:08PM +0200, Michal Hocko wrote: > On Fri 11-10-19 00:33:18, Uladzislau Rezki (Sony) wrote: > > Get rid of preempt_disable() and preempt_enable() when the > > preload is done for splitting purpose. The reason is that > > calling spin_lock() wi

Re: [PATCH 1/1] mm/vmalloc: remove preempt_disable/enable when do preloading

2019-10-14 Thread Uladzislau Rezki
On Fri, Oct 11, 2019 at 04:55:15PM -0700, Andrew Morton wrote: > On Thu, 10 Oct 2019 17:17:49 +0200 Uladzislau Rezki wrote: > > > > > :* The preload is done in non-atomic context, thus it allows us > > > > :* to use more permissive allo

[PATCH v2 1/1] mm/vmalloc: remove preempt_disable/enable when do preloading

2019-10-10 Thread Uladzislau Rezki (Sony)
dt (VMware) Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 50 +- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index e92ff5f7dd8b..f48cd0711478 100644 --- a/mm/vmalloc.c +++ b/mm/vmal

Re: [PATCH 1/1] mm/vmalloc: remove preempt_disable/enable when do preloading

2019-10-10 Thread Uladzislau Rezki
> > > > A few questions about the resulting alloc_vmap_area(): > > > > : static struct vmap_area *alloc_vmap_area(unsigned long size, > > : unsigned long align, > > : unsigned long vstart, unsigned long vend, > > : int

[PATCH 1/1] mm/vmalloc: remove preempt_disable/enable when do preloading

2019-10-09 Thread Uladzislau Rezki (Sony)
le. Fixes: 82dd23e84be3 ("mm/vmalloc.c: preload a CPU with one object for split purpose") Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index e92ff5f7dd8b..2ed6fef8

Re: [PATCH] mm: vmalloc: Use the vmap_area_lock to protect ne_fit_preload_node

2019-10-09 Thread Uladzislau Rezki
Hello, Daniel. On Wed, Oct 09, 2019 at 08:05:39AM +0200, Daniel Wagner wrote: > On Tue, Oct 08, 2019 at 06:04:59PM +0200, Uladzislau Rezki wrote: > > > so, we do not guarantee, instead we minimize number of allocations > > > with GFP_NOWAIT flag. For example on my

Re: [PATCH v4 1/2] rcu/tree: Add basic support for kfree_rcu() batching

2019-10-08 Thread Uladzislau Rezki
On Fri, Oct 04, 2019 at 01:20:38PM -0400, Joel Fernandes wrote: > On Tue, Oct 01, 2019 at 01:27:02PM +0200, Uladzislau Rezki wrote: > [snip] > > > > I have just a small question related to workloads and performance > > > > evaluation. > > > > Are you awa

Re: [PATCH] mm: vmalloc: Use the vmap_area_lock to protect ne_fit_preload_node

2019-10-08 Thread Uladzislau Rezki
On Mon, Oct 07, 2019 at 11:44:20PM +0200, Uladzislau Rezki wrote: > On Mon, Oct 07, 2019 at 07:36:44PM +0200, Sebastian Andrzej Siewior wrote: > > On 2019-10-07 18:56:11 [+0200], Uladzislau Rezki wrote: > > > Actually there is a high lock contention on vmap_area_lock, because

Re: [PATCH] mm: vmalloc: Use the vmap_area_lock to protect ne_fit_preload_node

2019-10-07 Thread Uladzislau Rezki
On Mon, Oct 07, 2019 at 07:36:44PM +0200, Sebastian Andrzej Siewior wrote: > On 2019-10-07 18:56:11 [+0200], Uladzislau Rezki wrote: > > Actually there is a high lock contention on vmap_area_lock, because it > > is still global. You can have a look at last slide:

Re: [PATCH] mm: vmalloc: Use the vmap_area_lock to protect ne_fit_preload_node

2019-10-07 Thread Uladzislau Rezki
On Mon, Oct 07, 2019 at 06:34:43PM +0200, Daniel Wagner wrote: > On Mon, Oct 07, 2019 at 06:23:30PM +0200, Uladzislau Rezki wrote: > > Hello, Daniel, Sebastian. > > > > > > On Fri, Oct 04, 2019 at 06:30:42PM +0200, Sebastian Andrzej Siewior > > > > wrote:

Re: [PATCH] mm: vmalloc: Use the vmap_area_lock to protect ne_fit_preload_node

2019-10-07 Thread Uladzislau Rezki
Hello, Daniel, Sebastian. > > On Fri, Oct 04, 2019 at 06:30:42PM +0200, Sebastian Andrzej Siewior wrote: > > > On 2019-10-04 18:20:41 [+0200], Uladzislau Rezki wrote: > > > > If we have migrate_disable/enable, then, i think preempt_enable/disable > > > > s

Re: [PATCH v8 1/5] kasan: support backing vmalloc space with real shadow memory

2019-10-07 Thread Uladzislau Rezki
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index a3c70e275f4e..9fb7a16f42ae 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -690,8 +690,19 @@ merge_or_add_vmap_area(struct vmap_area *va, > struct list_head *next; > struct rb_node **link; > struct rb_node *parent; > +

Re: [PATCH] mm: vmalloc: Use the vmap_area_lock to protect ne_fit_preload_node

2019-10-04 Thread Uladzislau Rezki
> > You could have been migrated to another CPU while > memory has been allocated. > That is true that we can migrate since we allow preemption when allocate. But it does not really matter on which CPU an allocation occurs and whether we migrate or not. If we land on another CPU or still stay on

Re: [PATCH] mm: vmalloc: Use the vmap_area_lock to protect ne_fit_preload_node

2019-10-04 Thread Uladzislau Rezki
On Fri, Oct 04, 2019 at 05:37:28PM +0200, Sebastian Andrzej Siewior wrote: > If you post something that is related to PREEMPT_RT please keep tglx and > me in Cc. > > On 2019-10-03 11:09:06 [+0200], Daniel Wagner wrote: > > Replace preempt_enable() and preempt_disable() with the vmap_area_lock > >

Re: [PATCH] mm: vmalloc: Use the vmap_area_lock to protect ne_fit_preload_node

2019-10-03 Thread Uladzislau Rezki
really make sense. > > Fixes: 82dd23e84be3 ("mm/vmalloc.c: preload a CPU with one object for > split purpose") > Cc: Uladzislau Rezki (Sony) > Signed-off-by: Daniel Wagner > --- > mm/vmalloc.c | 9 +++-- > 1 file changed, 3 insertions(+), 6 deletions(-)

Re: [PATCH v8 1/5] kasan: support backing vmalloc space with real shadow memory

2019-10-02 Thread Uladzislau Rezki
On Wed, Oct 02, 2019 at 11:23:06AM +1000, Daniel Axtens wrote: > Hi, > > >>/* > >> * Find a place in the tree where VA potentially will be > >> * inserted, unless it is merged with its sibling/siblings. > >> @@ -741,6 +752,10 @@ merge_or_add_vmap_area(struct vmap_area *va, > >>

Re: [PATCH v4 1/2] rcu/tree: Add basic support for kfree_rcu() batching

2019-10-01 Thread Uladzislau Rezki
> > Hello, Joel. > > > > First of all thank you for improving it. I also noticed a high pressure > > on RCU-machinery during performing some vmalloc tests when kfree_rcu() > > flood occurred. Therefore i got rid of using kfree_rcu() there. > > Replying a bit late due to overseas conference

Re: [PATCH v8 1/5] kasan: support backing vmalloc space with real shadow memory

2019-10-01 Thread Uladzislau Rezki
Hello, Daniel. > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index a3c70e275f4e..9fb7a16f42ae 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -690,8 +690,19 @@ merge_or_add_vmap_area(struct vmap_area *va, > struct list_head *next; > struct rb_node **link; > struct rb_node

Re: [PATCH v4 1/2] rcu/tree: Add basic support for kfree_rcu() batching

2019-09-18 Thread Uladzislau Rezki
> Recently a discussion about stability and performance of a system > involving a high rate of kfree_rcu() calls surfaced on the list [1] > which led to another discussion how to prepare for this situation. > > This patch adds basic batching support for kfree_rcu(). It is "basic" > because we do

Re: [PATCH 0/2] some cleanups related to RB_DECLARE_CALLBACKS_MAX

2019-08-13 Thread Uladzislau Rezki
> > I think it would be sufficient to call RBCOMPUTE(node, true) on every > node and check the return value ? > Yes, that is enough for sure. The only way i was thinking about to make it public, because checking the tree for MAX is generic for every users which use RB_DECLARE_CALLBACKS_MAX

Re: [PATCH 2/2] mm/vmalloc: use generated callback to populate subtree_max_size

2019-08-13 Thread Uladzislau Rezki
On Sun, Aug 11, 2019 at 05:39:23PM -0700, Michel Lespinasse wrote: > On Sun, Aug 11, 2019 at 11:46 AM Uladzislau Rezki (Sony) > wrote: > > RB_DECLARE_CALLBACKS_MAX defines its own callback to update the > > augmented subtree information after a node is modified. It make

Re: [PATCH 1/2] augmented rbtree: use max3() in the *_compute_max() function

2019-08-13 Thread Uladzislau Rezki
> On Sun, Aug 11, 2019 at 11:46 AM Uladzislau Rezki (Sony) > wrote: > > > > Recently there was introduced RB_DECLARE_CALLBACKS_MAX template. > > One of the callback, to be more specific *_compute_max(), calculates > > a maximum scalar value of node a

[PATCH 1/2] augmented rbtree: use max3() in the *_compute_max() function

2019-08-11 Thread Uladzislau Rezki (Sony)
the code more transparent. Signed-off-by: Uladzislau Rezki (Sony) --- include/linux/rbtree_augmented.h | 40 +- tools/include/linux/rbtree_augmented.h | 40 +- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git

<    1   2   3   4   5   6   7   >