lkml.org 
[lkml]   [2015]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v2] zram: Prevent page allocation failure during zcomp_strm_alloc
    Hello,

    On (11/23/15 11:15), Minchan Kim wrote:
    [..]
    > > static void *zcomp_lz4_create(void)
    > > {
    > > - return kzalloc(LZ4_MEM_COMPRESS, GFP_KERNEL);
    > > + void *ret;
    > > +
    > > + ret = kzalloc(LZ4_MEM_COMPRESS,
    > > + __GFP_NORETRY|__GFP_NOWARN|__GFP_NOMEMALLOC);
    > > + if (!ret)
    > > + ret = vzalloc(LZ4_MEM_COMPRESS);
    >
    > One thing I feel bad smell is that call vzalloc with GFP_KERNEL.
    > This function can be called in direct reclaim path with holding
    > fs lock and GFP_KERNEL can enter recursive reclaim path so
    > lockdep would complain theoretically if I don't miss something.
    >

    yes, GFP_KERNEL looks a bit fragile to me too. And may be zcomp_strm_alloc()
    and comp->backend->create() deserve GFP_NOFS. I believe I sent a patch doing
    this a while ago: https://lkml.org/lkml/2015/6/16/465

    > If it is true, we should fix several allocation flags in
    > zcomp_strm_alloc. I just want to record this warning for the future
    > in this thread so someone who is finding for the contribution
    > material will prove and fix it. :)

    I can re-send the patch.

    And, in case if you missed it, what's your opinion on the idea of
    reducing ->max_strm if we can't allocate new streams. Here:
    http://marc.info/?l=linux-kernel&m=144798049429861

    -ss


    \
     
     \ /
      Last update: 2015-11-23 04:21    [W:3.642 / U:0.048 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site