Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1279014rwb; Fri, 18 Nov 2022 15:56:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf5p1iUGACqnJ7QQbubG8wWOSOljsRlIV0kI24fI58LT33jNs2pGy+faAxfYT9x1Z4/1PzND X-Received: by 2002:aa7:c859:0:b0:461:17e9:4ea3 with SMTP id g25-20020aa7c859000000b0046117e94ea3mr8131008edt.49.1668815819561; Fri, 18 Nov 2022 15:56:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668815819; cv=none; d=google.com; s=arc-20160816; b=0M93DMFmlu+l2WjNjmKApOjmCH90UG8vEWFMuiMBhQN0q1S7+p0HMfQvDf78tEvIbh zQgUI4+ca0TUgt+dOBXWwCH+va5IPET+0mHt1/XyYhh0i6tTYReen3TgZbNtQjo6dS5N ZffebK5gKtOaEJFCZUT3O59D3BEx+To0x+lkc0iDgQbfnFoN13P1pFL2X/5G7tvGnWxQ SZgJsY7rk7SO2lfq4eNX49A6fhwcVvDGvzyqnu7SLL7PpsuW/kWlX1keOzcdyzG41CnO gfwlH8eV5hw8xJH6ltbcmd/q8ii2XzHwj6MJr7/ZA8oxb5SuSR5PlVN9rn3grSNoFvgV g5MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JTPRlJSX2DLHg3q6WEUslM2aHDz3cJkv4J+i/NOGxF8=; b=NGA0A4kyQzHR/YVL95foV0xYVPiYKY0FqzUsZtQ8xvUY//znJs9kKc4XIZNaUr8HvY AMo+AtzYHINX4Ys6F3tDp8e2aBgPp/3di3Uf4tZLpk9TAewtirnSgBi/jmf1ff0eKOC5 SKGldIRJ/xMKUEKLBWc/OcDdGcmU4NazcNnvUSWohUxBCYt1DxsCMsQ2R9QTdhGQTyJ9 /gzAwTjazu7rVZEMrWQfmnCfR4lC2ZtvBSWQLjfKIGeEonPGBcFRlDb3ZTz3Kwll6L0l rhi+ZjSzG4KILrMGv5SEV2uA9R/7H0q/wEooW0VqcxuOzJPPxe57wqahyWmM+qoqWlVE 25Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b="75OTZs/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a27-20020a170906191b00b007adadfc97c7si3608084eje.918.2022.11.18.15.56.37; Fri, 18 Nov 2022 15:56:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b="75OTZs/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236746AbiKRXkp (ORCPT + 90 others); Fri, 18 Nov 2022 18:40:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236818AbiKRXh5 (ORCPT ); Fri, 18 Nov 2022 18:37:57 -0500 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1B4EA6A0C for ; Fri, 18 Nov 2022 15:22:46 -0800 (PST) Received: by mail-qt1-x834.google.com with SMTP id jr19so4148933qtb.7 for ; Fri, 18 Nov 2022 15:22:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=JTPRlJSX2DLHg3q6WEUslM2aHDz3cJkv4J+i/NOGxF8=; b=75OTZs/um0vrPFpf4rivUwFVfj569zfn8Hctoup+Fiv3oEqtIn6IcBbfbBi6nnc/bg +sv4KCRJeHTLu/hxv/C79WXWDvufJOLxFizqU3kSkItW/vZ+W4KQxRlvEHDqBH2KApqX 2+vhesXQDjfneOy93QfjPCfRnRIP4KLc0S07SuuXkdv7MSijUXpYNj/vl50qwidHgMaR RiwkvOb2FzxMWxSsf7nIKyx2IJobE4YFPoQl8/+bOV7mWjlMb/9RvAtAsJz2xj/LwFVm YgpYyNnEw1OJCvTUD5F/qGt1aVaZFwiGHKM0w2C9V9L3tFjRNI7gEgopa/C81ACAYm0u 6IhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JTPRlJSX2DLHg3q6WEUslM2aHDz3cJkv4J+i/NOGxF8=; b=SJDJx8jZHZGD1MoZzqo7/QjISeFF9pHAee7g3/+lHWYZsLyCvOVW+rAZjx5oolE+CP r54jyRsy/TUhDj7t9QYUmL91x8m5D5iUsuPnLAgVdsBUMrb4HyGRQmFKTOCZLhcExA5e xi4EeR5PhVMiFdQiRBSbdBOtGRAQPo30kLzbAF+h+H5q0bnpqWPlUtuLVgURlIP9cnGS rIPlNaNFjJ+bKhW1nq5UVKEMdcPkuzzQcn4AVwylhMFjqz7MbOxxuo2GMCRkCsWhV1sN EocjaWxZfsxHSG5VDGtcVrPEtBQsaRre+Wva0oeY3UuzmDAVqkTd/rV5oiODNUYS+qaf d0RQ== X-Gm-Message-State: ANoB5pnbxAir0P0owN+36UxI9/+scmIKmduE4IoLpLfCZQ57rhFzbLBN gJX6yQZBVYdPS7fLA+GZuladLg== X-Received: by 2002:ac8:4a10:0:b0:3a5:30f8:17b4 with SMTP id x16-20020ac84a10000000b003a530f817b4mr8810660qtq.115.1668813766064; Fri, 18 Nov 2022 15:22:46 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:bc4]) by smtp.gmail.com with ESMTPSA id t7-20020a37ea07000000b006fa2cc1b0fbsm3304307qkj.11.2022.11.18.15.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 15:22:45 -0800 (PST) Date: Fri, 18 Nov 2022 18:23:09 -0500 From: Johannes Weiner To: Minchan Kim Cc: Nhat Pham , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ngupta@vflare.org, senozhatsky@chromium.org, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com Subject: Re: [PATCH v5 4/6] zsmalloc: Add a LRU to zs_pool to keep track of zspages in LRU order Message-ID: References: <20221118182407.82548-1-nphamcs@gmail.com> <20221118182407.82548-5-nphamcs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 18, 2022 at 01:35:01PM -0800, Minchan Kim wrote: > On Fri, Nov 18, 2022 at 03:05:04PM -0500, Johannes Weiner wrote: > > On Fri, Nov 18, 2022 at 11:32:01AM -0800, Minchan Kim wrote: > > > On Fri, Nov 18, 2022 at 10:24:05AM -0800, Nhat Pham wrote: > > > > @@ -1444,6 +1473,11 @@ unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp) > > > > > > > > /* We completely set up zspage so mark them as movable */ > > > > SetZsPageMovable(pool, zspage); > > > > +out: > > > > +#ifdef CONFIG_ZPOOL > > > > + /* Move the zspage to front of pool's LRU */ > > > > + move_to_front(pool, zspage); > > > > +#endif > > > > spin_unlock(&pool->lock); > > > > > > Please move the move_to_front into zs_map_object with ZS_MM_WO with > > > comment with "why we are doing only for WO case". > > > > I replied to the other thread, but I disagree with this request. > > > > The WO exception would be as zswap-specific as is the > > rotate-on-alloc. It doesn't make the resulting zsmalloc code any > > That's true but at least, zs_pool allocators have the accessor so > that's fair place to have the LRU updating. I guess that's why > you agreed that's better place. No? > > I understand that's zswap-specific that the bad design keeps > pushing smelly code into allocators and then "push to take it > since other were already doing" with "we will take them off with > better solution in future". I am really struggling to understand > this concept. Johannes, Is that really how we work over a decade? My point was that there is no difference between having zswap code in alloc or in map. And there is a small upside to having it in alloc because of the other backends. But I won't fight you on it. The code isn't going to stay like this for long anyway.