Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752838AbaD0ENy (ORCPT ); Sun, 27 Apr 2014 00:13:54 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:35419 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751902AbaD0ENw (ORCPT ); Sun, 27 Apr 2014 00:13:52 -0400 MIME-Version: 1.0 In-Reply-To: References: <1397922764-1512-1-git-send-email-ddstreet@ieee.org> <1397922764-1512-3-git-send-email-ddstreet@ieee.org> From: Dan Streetman Date: Sun, 27 Apr 2014 00:13:30 -0400 X-Google-Sender-Auth: K3hWrsPd78lo_E4227SJzVDFUvo Message-ID: Subject: Re: [PATCH 2/4] mm: zpool: implement zsmalloc shrinking To: Weijie Yang Cc: Seth Jennings , Minchan Kim , Nitin Gupta , Andrew Morton , Bob Liu , Hugh Dickins , Mel Gorman , Rik van Riel , Weijie Yang , Johannes Weiner , Sergey Senozhatsky , Linux-MM , linux-kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 26, 2014 at 4:37 AM, Weijie Yang wrote: > On Sat, Apr 19, 2014 at 11:52 PM, Dan Streetman wrote: >> Add zs_shrink() and helper functions to zsmalloc. Update zsmalloc >> zs_create_pool() creation function to include ops param that provides >> an evict() function for use during shrinking. Update helper function >> fix_fullness_group() to always reinsert changed zspages even if the >> fullness group did not change, so they are updated in the fullness >> group lru. Also update zram to use the new zsmalloc pool creation >> function but pass NULL as the ops param, since zram does not use >> pool shrinking. >> > > I only review the code without test, however, I think this patch is > not acceptable. > > The biggest problem is it will call zswap_writeback_entry() under lock, > zswap_writeback_entry() may sleep, so it is a bug. see below thanks for catching that! > > The 3/4 patch has a lot of #ifdef, I don't think it's a good kind of > abstract way. it has the #ifdef's because there's no point in compiling in code to use zbud/zsmalloc if zbud/zsmalloc isn't compiled...what alternative to #ifdef's would you suggest? Or are there just specific #ifdefs you suggest to remove? > > What about just disable zswap reclaim when using zsmalloc? > There is a long way to optimize writeback reclaim(both zswap and zram) , > Maybe a small and simple step forward is better. I think it's possible to just remove the zspage from the class while under lock, then unlock and reclaim it. As long as there's a guarantee that zswap (or any zpool/zsmalloc reclaim user) doesn't map/access the handle after evict() completes successfully, that should work. There does need to be some synchronization between zs_free() and each handle's eviction though, similar to zbud's under_reclaim flag. I'll work on a v2 patch. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/