lkml.org 
[lkml]   [2015]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 0/5] do not dereference NULL pools in pools' destroy() functions
On Tue, 9 Jun 2015, Andrew Morton wrote:

> > > More than half of the kmem_cache_destroy() callsites are declining that
> > > value by open-coding the NULL test. That's reality and we should recognize
> > > it.
> >
> > Well that may just indicate that we need to have a look at those
> > callsites and the reason there to use a special cache at all.
>
> This makes no sense. Go look at the code.
> drivers/staging/lustre/lustre/llite/super25.c, for example. It's all
> in the basic unwind/recover/exit code.

That is screwed up code. I'd do that without the checks simply with a
series of kmem_cache_destroys().

> > If the cache
> > is just something that kmalloc can provide then why create a special
> > cache. On the other hand if something special needs to be accomplished
> > then it would make sense to have special processing on kmem_cache_destroy.
>
> This has nothing to do with anything. We're talking about a basic "if
> I created this cache then destroy it" operation.

As you see in this code snipped you cannot continue if a certain operation
during setup fails. At that point it is known which caches exist and
therefore kmem_cache_destroy() can be called without the checks.

> It's a common pattern. mm/ exists to serve client code and as a lot of
> client code is doing this, we should move it into mm/ so as to serve
> client code better.

Doing this seems to encourage sloppy coding practices.




\
 
 \ /
  Last update: 2015-06-11 19:41    [W:0.064 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site