From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752726AbbGNAbD (ORCPT ); Mon, 13 Jul 2015 20:31:03 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:32888 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751966AbbGNAbA (ORCPT ); Mon, 13 Jul 2015 20:31:00 -0400 Date: Tue, 14 Jul 2015 09:31:32 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Sergey Senozhatsky , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH 0/3] zsmalloc: small compaction improvements Message-ID: <20150714003132.GA2463@swordfish> References: <1436607932-7116-1-git-send-email-sergey.senozhatsky@gmail.com> <20150713233602.GA31822@blaptop.AC68U> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150713233602.GA31822@blaptop.AC68U> 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 Hello Minchan, On (07/14/15 08:36), Minchan Kim wrote: [..] > > if [ `cat /sys/block/zram/compact` -gt 10 ]; then > > echo 1 > /sys/block/zram/compact; > > fi > > > > Up until now user space could not tell whether compaction > > will result in any gain. > > First of all, thanks for the looking this. > > Question: > > What is motivation? > IOW, did you see big overhead by user-triggered compaction? so, > do you want to throttle it by userspace? It depends on 'big overhead' definition, of course. We don't care that much when compaction is issued by the shrinker, because things are getting bad and we can sacrifice performance. But user triggered compaction on a I/O pressured device can needlessly slow things down, especially now, when we drain ALMOST_FULL classes. /sys/block/zram/compact is a black box. We provide it, we don't throttle it in the kernel, and user space is absolutely clueless when it invokes compaction. From some remote (or alternative) point of view compaction can be seen as "zsmalloc's cache flush" (unused objects make write path quicker - no zspage allocation needed) and it won't hurt to give user space some numbers so it can decide if the whole thing is worth it (that decision is, once again, I/O pattern and setup specific -- some users may be interested in compaction only if it will reduce zsmalloc's memory consumption by, say, 15%). -ss