Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-20 Thread Srikar Dronamraju
* Vlastimil Babka [2020-03-20 09:43:11]: > On 3/20/20 8:46 AM, Srikar Dronamraju wrote: > > * Vlastimil Babka [2020-03-19 15:10:19]: > > > >> On 3/19/20 3:05 PM, Srikar Dronamraju wrote: > >> > * Vlastimil Babka [2020-03-19 14:47:58]: > >> > > >> > >> No, but AFAICS, such node values are

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-20 Thread Bharata B Rao
On Fri, Mar 20, 2020 at 09:37:18AM +0100, Vlastimil Babka wrote: > On 3/20/20 4:42 AM, Bharata B Rao wrote: > > On Thu, Mar 19, 2020 at 02:47:58PM +0100, Vlastimil Babka wrote: > >> diff --git a/mm/slub.c b/mm/slub.c > >> index 17dc00e33115..7113b1f9cd77 100644 > >> --- a/mm/slub.c > >> +++

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-20 Thread Vlastimil Babka
On 3/20/20 8:46 AM, Srikar Dronamraju wrote: > * Vlastimil Babka [2020-03-19 15:10:19]: > >> On 3/19/20 3:05 PM, Srikar Dronamraju wrote: >> > * Vlastimil Babka [2020-03-19 14:47:58]: >> > >> >> No, but AFAICS, such node values are already handled in ___slab_alloc, and >> cannot reach

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-20 Thread Vlastimil Babka
On 3/20/20 4:42 AM, Bharata B Rao wrote: > On Thu, Mar 19, 2020 at 02:47:58PM +0100, Vlastimil Babka wrote: >> diff --git a/mm/slub.c b/mm/slub.c >> index 17dc00e33115..7113b1f9cd77 100644 >> --- a/mm/slub.c >> +++ b/mm/slub.c >> @@ -1973,8 +1973,6 @@ static void *get_partial(struct kmem_cache *s,

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-20 Thread Srikar Dronamraju
* Vlastimil Babka [2020-03-19 15:10:19]: > On 3/19/20 3:05 PM, Srikar Dronamraju wrote: > > * Vlastimil Babka [2020-03-19 14:47:58]: > > > >> 8< > >> diff --git a/mm/slub.c b/mm/slub.c > >> index 17dc00e33115..7113b1f9cd77 100644 > >> --- a/mm/slub.c > >> +++ b/mm/slub.c > >> @@

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-19 Thread Bharata B Rao
On Thu, Mar 19, 2020 at 02:47:58PM +0100, Vlastimil Babka wrote: > diff --git a/mm/slub.c b/mm/slub.c > index 17dc00e33115..7113b1f9cd77 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -1973,8 +1973,6 @@ static void *get_partial(struct kmem_cache *s, gfp_t > flags, int node, > > if (node

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-19 Thread Sachin Sant
>>> Great, thanks! Can I add your Tested-by: then? >> >> Sure. >> Tested-by: Sachin Sant >> >> Thank you for the fix. > > Thanks! Sorry to bother, but in the end I decided to do further change so I > would appreciate verification if it still works as intended. Works as expected. I am able to

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-19 Thread Vlastimil Babka
On 3/19/20 3:05 PM, Srikar Dronamraju wrote: > * Vlastimil Babka [2020-03-19 14:47:58]: > >> 8< >> diff --git a/mm/slub.c b/mm/slub.c >> index 17dc00e33115..7113b1f9cd77 100644 >> --- a/mm/slub.c >> +++ b/mm/slub.c >> @@ -1973,8 +1973,6 @@ static void *get_partial(struct kmem_cache *s,

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-19 Thread Srikar Dronamraju
* Vlastimil Babka [2020-03-19 14:47:58]: > 8< > diff --git a/mm/slub.c b/mm/slub.c > index 17dc00e33115..7113b1f9cd77 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -1973,8 +1973,6 @@ static void *get_partial(struct kmem_cache *s, gfp_t > flags, int node, > > if (node ==

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-19 Thread Vlastimil Babka
On 3/19/20 2:26 PM, Sachin Sant wrote: > > >> On 19-Mar-2020, at 6:53 PM, Vlastimil Babka wrote: >> >> On 3/19/20 9:52 AM, Sachin Sant wrote: >>> OK how about this version? It's somewhat ugly, but important is that the fast path case (c->page exists) is unaffected and another

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-19 Thread Sachin Sant
> On 19-Mar-2020, at 6:53 PM, Vlastimil Babka wrote: > > On 3/19/20 9:52 AM, Sachin Sant wrote: >> >>> OK how about this version? It's somewhat ugly, but important is that the >>> fast >>> path case (c->page exists) is unaffected and another common case (c->page is >>> NULL, but node is

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-19 Thread Vlastimil Babka
On 3/19/20 9:52 AM, Sachin Sant wrote: > >> OK how about this version? It's somewhat ugly, but important is that the fast >> path case (c->page exists) is unaffected and another common case (c->page is >> NULL, but node is NUMA_NO_NODE) is just one extra check - impossible to >> avoid at >> some

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-19 Thread Sachin Sant
> OK how about this version? It's somewhat ugly, but important is that the fast > path case (c->page exists) is unaffected and another common case (c->page is > NULL, but node is NUMA_NO_NODE) is just one extra check - impossible to avoid > at > some point anyway. > I attempted the suggested

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-18 Thread Vlastimil Babka
ra check - impossible to avoid at some point anyway. ----8<---- >From d1675363c2ddc3758e5c0d0f435ca46818219194 Mon Sep 17 00:00:00 2001 From: Vlastimil Babka Date: Wed, 18 Mar 2020 14:47:33 +0100 Subject: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks Sachin reports [1] a

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-18 Thread Vlastimil Babka
On 3/18/20 5:06 PM, Bharata B Rao wrote: > On Wed, Mar 18, 2020 at 03:42:19PM +0100, Vlastimil Babka wrote: >> This is a PowerPC platform with following NUMA topology: >> >> available: 2 nodes (0-1) >> node 0 cpus: >> node 0 size: 0 MB >> node 0 free: 0 MB >> node 1 cpus: 0 1 2 3 4 5 6 7 8 9 10

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-18 Thread Bharata B Rao
On Wed, Mar 18, 2020 at 03:42:19PM +0100, Vlastimil Babka wrote: > This is a PowerPC platform with following NUMA topology: > > available: 2 nodes (0-1) > node 0 cpus: > node 0 size: 0 MB > node 0 free: 0 MB > node 1 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 > 25 26

[RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-18 Thread Vlastimil Babka
Sachin reports [1] a crash in SLUB __slab_alloc(): BUG: Kernel NULL pointer dereference on read at 0x73b0 Faulting instruction address: 0xc03d55f4 Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries Modules linked in: CPU: 19 PID: 1