From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752760AbcEMIFw (ORCPT ); Fri, 13 May 2016 04:05:52 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36762 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751184AbcEMIFo (ORCPT ); Fri, 13 May 2016 04:05:44 -0400 Date: Fri, 13 May 2016 17:06:43 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Sergey Senozhatsky , Sergey Senozhatsky , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] zram: introduce per-device debug_stat sysfs node Message-ID: <20160513080643.GE615@swordfish> References: <20160511134553.12655-1-sergey.senozhatsky@gmail.com> <20160512234143.GA27204@bbox> <20160513010929.GA615@swordfish> <20160513062303.GA21204@bbox> <20160513065805.GB615@swordfish> <20160513070553.GC615@swordfish> <20160513072006.GA21484@bbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160513072006.GA21484@bbox> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (05/13/16 16:20), Minchan Kim wrote: > > > > @@ -737,12 +737,12 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, > > > > zcomp_strm_release(zram->comp, zstrm); > > > > zstrm = NULL; > > > > > > > > - atomic64_inc(&zram->stats.num_recompress); > > > > - > > > > handle = zs_malloc(meta->mem_pool, clen, > > > > GFP_NOIO | __GFP_HIGHMEM); > > > > - if (handle) > > > > + if (handle) { > > > > + atomic64_inc(&zram->stats.num_recompress); > > > > goto compress_again; > > > > + } just a small note: > Although 2 is smaller, your patch just accounts only direct reclaim but my > suggestion can count both 1 and 2 so isn't it better? no, my patch accounts 1) and 2) as well. the only difference is that my patch accounts second zs_malloc() call _EVEN_ if it has failed and we jumped to goto err (because we still could have done reclaim). the new version would account second zs_malloc() _ONLY_ if it has succeeded, and thus possibly reclaim would not be accounted. recompress: compress handle = zs_malloc FAST PATH if (!handle) { release stream handle = zs_malloc SLOW PATH << my patch accounts SLOW PATH here >> if (handle) { num_recompress++ << NEW version accounts it here, only it was OK >> goto recompress; } goto err; << SLOW PATH is not accounted if SLOW PATH was unsuccessful } -ss