From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752212AbbGJAti (ORCPT ); Thu, 9 Jul 2015 20:49:38 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:35468 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751216AbbGJAt3 (ORCPT ); Thu, 9 Jul 2015 20:49:29 -0400 Date: Fri, 10 Jul 2015 09:49:21 +0900 From: Minchan Kim To: Sergey Senozhatsky Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH v7 7/7] zsmalloc: use shrinker to trigger auto-compaction Message-ID: <20150710004921.GA10230@bgram> References: <1436355113-12417-1-git-send-email-sergey.senozhatsky@gmail.com> <1436355113-12417-8-git-send-email-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436355113-12417-8-git-send-email-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sergey, On Wed, Jul 08, 2015 at 08:31:53PM +0900, Sergey Senozhatsky wrote: > Perform automatic pool compaction by a shrinker when system > is getting tight on memory. > > User-space has a very little knowledge regarding zsmalloc fragmentation > and basically has no mechanism to tell whether compaction will result > in any memory gain. Another issue is that user space is not always > aware of the fact that system is getting tight on memory. Which leads > to very uncomfortable scenarios when user space may start issuing > compaction 'randomly' or from crontab (for example). Fragmentation > is not always necessarily bad, allocated and unused objects, after all, > may be filled with the data later, w/o the need of allocating a new > zspage. On the other hand, we obviously don't want to waste memory > when the system needs it. > > Compaction now has a relatively quick pool scan so we are able to > estimate the number of pages that will be freed easily, which makes it > possible to call this function from a shrinker->count_objects() callback. > We also abort compaction as soon as we detect that we can't free any > pages any more, preventing wasteful objects migrations. > > Signed-off-by: Sergey Senozhatsky > Suggested-by: Minchan Kim Acked-by: Minchan Kim Thanks for great work!