From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752988AbbCEF3j (ORCPT ); Thu, 5 Mar 2015 00:29:39 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:46347 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751763AbbCEF3h (ORCPT ); Thu, 5 Mar 2015 00:29:37 -0500 Date: Thu, 5 Mar 2015 14:29:42 +0900 From: Sergey Senozhatsky To: minchan@kernel.org Cc: akpm@linux-foundation.org, ddstreet@ieee.org, gunho.lee@lge.com, iamjoonsoo.kim@lge.com, jmarchan@redhat.com, juno.choi@lge.com, mel@csn.ul.ie, ngupta@vflare.org, semenzato@google.com, sergey.senozhatsky@gmail.com, sjennings@variantweb.net, mm-commits@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: + zram-support-compaction.patch added to -mm tree Message-ID: <20150305052941.GK14927@swordfish> References: <54f780fc.3sOWZKr7rufmI85r%akpm@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54f780fc.3sOWZKr7rufmI85r%akpm@linux-foundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (03/04/15 14:02), akpm@linux-foundation.org wrote: > +What: /sys/block/zram/compact > +Date: August 2015 > +Contact: Minchan Kim > +Description: > + The compact file is write-only and trigger compaction for > + allocator zrm uses. The allocator moves some objects so that > + it could free fragment space. > + > +What: /sys/block/zram/num_migrated > +Date: August 2015 > +Contact: Minchan Kim > +Description: > + The compact file is read-only and shows how many object > + migrated by compaction. > diff -puN drivers/block/zram/zram_drv.c~zram-support-compaction drivers/block/zram/zram_drv.c > --- a/drivers/block/zram/zram_drv.c~zram-support-compaction > +++ a/drivers/block/zram/zram_drv.c > @@ -70,6 +70,27 @@ static inline struct zram *dev_to_zram(s > return (struct zram *)dev_to_disk(dev)->private_data; > } First of all, my apologies to Andrew Morton. if I reply to this email, my mutt for some reason replaces akpm at linux-foundation.org with linux-kernel at vger.kernel.org (I can't see why this is happening, but this is somehow a `stable behaviour'). I didn't spot this, so this is why Andrew was not Cc-d to my previous reply to this eamil. rather a discussion question. Minchan, do you want to provide num_migrated as part of zsmalloc stats rather than having yet another zram attr? we already provide zsmalloc stats and this type of information seems to belong there. just idea. -ss > > +static ssize_t compact_store(struct device *dev, > + struct device_attribute *attr, const char *buf, size_t len) > +{ > + unsigned long nr_migrated; > + struct zram *zram = dev_to_zram(dev); > + struct zram_meta *meta; > + > + down_read(&zram->init_lock); > + if (!init_done(zram)) { > + up_read(&zram->init_lock); > + return -EINVAL; > + } > + > + meta = zram->meta; > + nr_migrated = zs_compact(meta->mem_pool); > + atomic64_add(nr_migrated, &zram->stats.num_migrated); > + up_read(&zram->init_lock); > + > + return len; > +}