Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753162AbbKWDND (ORCPT ); Sun, 22 Nov 2015 22:13:03 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35148 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752991AbbKWDNC (ORCPT ); Sun, 22 Nov 2015 22:13:02 -0500 Date: Mon, 23 Nov 2015 12:14:00 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Kyeongdon Kim , Andrew Morton , ngupta@vflare.org, sergey.senozhatsky.work@gmail.com, linux-kernel@vger.kernel.org, sergey.senozhatsky@gmail.com Subject: Re: [PATCH v2] zram: Prevent page allocation failure during zcomp_strm_alloc Message-ID: <20151123031400.GA7449@swordfish> References: <1448013764-21899-1-git-send-email-kyeongdon.kim@lge.com> <20151123021531.GA10428@bbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151123021531.GA10428@bbox> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1485 Lines: 41 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/