From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756267AbbGFNtm (ORCPT ); Mon, 6 Jul 2015 09:49:42 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:33045 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755414AbbGFNth (ORCPT ); Mon, 6 Jul 2015 09:49:37 -0400 Date: Mon, 6 Jul 2015 22:48:50 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Sergey Senozhatsky , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 6/7] zsmalloc: account the number of compacted pages Message-ID: <20150706134850.GB663@swordfish> References: <1436185070-1940-1-git-send-email-sergey.senozhatsky@gmail.com> <1436185070-1940-7-git-send-email-sergey.senozhatsky@gmail.com> <20150706132249.GA16529@blaptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150706132249.GA16529@blaptop> User-Agent: Mutt/1.5.23+89 (0255b37be491) (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (07/06/15 22:22), Minchan Kim wrote: > On Mon, Jul 06, 2015 at 09:17:49PM +0900, Sergey Senozhatsky wrote: > > Compaction returns back to zram the number of migrated objects, > > which is quite uninformative -- we have objects of different > > sizes so user space cannot obtain any valuable data from that > > number. Change compaction to operate in terms of pages and > > return back to compaction issuer the number of pages that > > were freed during compaction. So from now on `num_compacted' > > column in zram/mm_stat represents more meaningful value: > > the number of freed (compacted) pages. > > Fair enough. > > The main reason I introduced num_migrated is to investigate > the effieciency of compaction. ie, num_freed / num_migrated. > However, I didn't put num_freed at that time so I can't get > my goal with only num_migrated. > > We could put new knob num_compacted as well as num_migrated > but I don't think we need it now. Zram's compaction would be > much efficient compared to VM's compaction because we don't > have any non-movable objects in zspages and we can account > exact number of free slots. > > So, I want to change name from num_migrated to num_compacted > and maintain only it which is more useful for admin, you said. > > It's not far since we introduced num_migrated so I don't think > change name wouldn't be a big problem for userspace,(I hope). > Hello, Yes, num_migrated rename patch was on my table. I was thinking about two variants: struct zs_pool atomic_long_t pages_allocated; unsigned long num_compacted; or struct zs_pool atomic_long_t pages_allocated; unsigned long pages_compacted; the latter looks even better I think. But I didn't come up with a sane API name to get these stats-- zs_get_pages_compacted() is a bit misleading. So I decided to keep num_compacted to make the patch set smaller. Hm, exporting a new `struct zs_pool_stat' to zram is probably a good way to go. -ss