From: Johannes Weiner <hannes@cmpxchg.org>
To: "Jörn Engel" <joern@logfs.org>
Cc: Julia Lawall <julia@diku.dk>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 3/5] mm: Add kmalloc NULL tests
Date: Thu, 30 Jul 2009 19:12:14 +0000 [thread overview]
Message-ID: <20090730191213.GA9471@cmpxchg.org> (raw)
In-Reply-To: <20090730183558.GA11763@logfs.org>
On Thu, Jul 30, 2009 at 08:35:59PM +0200, Jörn Engel wrote:
> On Thu, 30 July 2009 17:36:58 +0200, Johannes Weiner wrote:
> > On Thu, Jul 30, 2009 at 04:10:22PM +0200, Julia Lawall wrote:
> >
> > > diff --git a/mm/slab.c b/mm/slab.c
> > > index 7b5d4de..972e427 100644
> > > --- a/mm/slab.c
> > > +++ b/mm/slab.c
> > > @@ -1502,6 +1502,7 @@ void __init kmem_cache_init(void)
> > >
> > > ptr = kmalloc(sizeof(struct arraycache_init), GFP_NOWAIT);
> > >
> > > + BUG_ON(!ptr);
> > > BUG_ON(cpu_cache_get(&cache_cache) != &initarray_cache.cache);
> > > memcpy(ptr, cpu_cache_get(&cache_cache),
> > > sizeof(struct arraycache_init));
> >
> > This does not change the end result when the allocation fails: you get
> > a stacktrace and a kernel panic. Leaving it as is saves a line of
> > code.
>
> According to http://lwn.net/Articles/342420/, there may be a subtle
> difference.
You will probably have a hard time establishing a userspace mapping
before slab is initializied :)
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Johannes Weiner <hannes@cmpxchg.org>
To: "Jörn Engel" <joern@logfs.org>
Cc: Julia Lawall <julia@diku.dk>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 3/5] mm: Add kmalloc NULL tests
Date: Thu, 30 Jul 2009 21:12:14 +0200 [thread overview]
Message-ID: <20090730191213.GA9471@cmpxchg.org> (raw)
In-Reply-To: <20090730183558.GA11763@logfs.org>
On Thu, Jul 30, 2009 at 08:35:59PM +0200, Jörn Engel wrote:
> On Thu, 30 July 2009 17:36:58 +0200, Johannes Weiner wrote:
> > On Thu, Jul 30, 2009 at 04:10:22PM +0200, Julia Lawall wrote:
> >
> > > diff --git a/mm/slab.c b/mm/slab.c
> > > index 7b5d4de..972e427 100644
> > > --- a/mm/slab.c
> > > +++ b/mm/slab.c
> > > @@ -1502,6 +1502,7 @@ void __init kmem_cache_init(void)
> > >
> > > ptr = kmalloc(sizeof(struct arraycache_init), GFP_NOWAIT);
> > >
> > > + BUG_ON(!ptr);
> > > BUG_ON(cpu_cache_get(&cache_cache) != &initarray_cache.cache);
> > > memcpy(ptr, cpu_cache_get(&cache_cache),
> > > sizeof(struct arraycache_init));
> >
> > This does not change the end result when the allocation fails: you get
> > a stacktrace and a kernel panic. Leaving it as is saves a line of
> > code.
>
> According to http://lwn.net/Articles/342420/, there may be a subtle
> difference.
You will probably have a hard time establishing a userspace mapping
before slab is initializied :)
WARNING: multiple messages have this Message-ID (diff)
From: Johannes Weiner <hannes@cmpxchg.org>
To: "Jörn Engel" <joern@logfs.org>
Cc: Julia Lawall <julia@diku.dk>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 3/5] mm: Add kmalloc NULL tests
Date: Thu, 30 Jul 2009 21:12:14 +0200 [thread overview]
Message-ID: <20090730191213.GA9471@cmpxchg.org> (raw)
In-Reply-To: <20090730183558.GA11763@logfs.org>
On Thu, Jul 30, 2009 at 08:35:59PM +0200, JA?rn Engel wrote:
> On Thu, 30 July 2009 17:36:58 +0200, Johannes Weiner wrote:
> > On Thu, Jul 30, 2009 at 04:10:22PM +0200, Julia Lawall wrote:
> >
> > > diff --git a/mm/slab.c b/mm/slab.c
> > > index 7b5d4de..972e427 100644
> > > --- a/mm/slab.c
> > > +++ b/mm/slab.c
> > > @@ -1502,6 +1502,7 @@ void __init kmem_cache_init(void)
> > >
> > > ptr = kmalloc(sizeof(struct arraycache_init), GFP_NOWAIT);
> > >
> > > + BUG_ON(!ptr);
> > > BUG_ON(cpu_cache_get(&cache_cache) != &initarray_cache.cache);
> > > memcpy(ptr, cpu_cache_get(&cache_cache),
> > > sizeof(struct arraycache_init));
> >
> > This does not change the end result when the allocation fails: you get
> > a stacktrace and a kernel panic. Leaving it as is saves a line of
> > code.
>
> According to http://lwn.net/Articles/342420/, there may be a subtle
> difference.
You will probably have a hard time establishing a userspace mapping
before slab is initializied :)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-07-30 19:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-30 14:10 [PATCH 3/5] mm: Add kmalloc NULL tests Julia Lawall
2009-07-30 14:10 ` Julia Lawall
2009-07-30 14:10 ` Julia Lawall
2009-07-30 15:36 ` Johannes Weiner
2009-07-30 15:36 ` Johannes Weiner
2009-07-30 15:36 ` Johannes Weiner
2009-07-30 18:35 ` Jörn Engel
2009-07-30 18:35 ` Jörn Engel
2009-07-30 18:35 ` Jörn Engel
2009-07-30 19:12 ` Johannes Weiner [this message]
2009-07-30 19:12 ` Johannes Weiner
2009-07-30 19:12 ` Johannes Weiner
2009-07-30 20:19 ` Jörn Engel
2009-07-30 20:19 ` Jörn Engel
2009-07-30 20:19 ` Jörn Engel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090730191213.GA9471@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=joern@logfs.org \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.