From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 534C3C4332F for ; Wed, 9 Nov 2022 21:55:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B099B6B0072; Wed, 9 Nov 2022 16:55:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A9B828E0001; Wed, 9 Nov 2022 16:55:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9338E6B0075; Wed, 9 Nov 2022 16:55:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 803B56B0072 for ; Wed, 9 Nov 2022 16:55:49 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5117A1C6C14 for ; Wed, 9 Nov 2022 21:55:49 +0000 (UTC) X-FDA: 80115261618.20.6AAB3F7 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by imf26.hostedemail.com (Postfix) with ESMTP id E3E5E14000A for ; Wed, 9 Nov 2022 21:55:48 +0000 (UTC) Received: by mail-pg1-f182.google.com with SMTP id o13so8049115pgu.7 for ; Wed, 09 Nov 2022 13:55:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=MYg5m0atdOw1dxzpeo8zRV+fGD2ca4bGE4Ou9GGosT8=; b=JZ1aEngmeUjTyS0jGftdK9sfnEOYpywxOW8vTmF8M0XKg9fIbQuh88iEUN4HWiDTpf A0/olhVTqMj7brak4I2mXLsGDwPy6JAx5FLbQBPvQEdUeyQ7xBrtLcRDZeW/+Lusmxyq aBZ1phYnJM92P5aZydE4CN8ZeEweeBV1NhHomh4QmorYskOPi/biYyznZ4JOe6jL6DYM LZkjuA58DlrdPniBGroEmCvgVhV471Xfyh/vKM+YMQ1RDY9MaYEiDKDcyPsw3XHDjb0k L0eMUyDs8Fk6lojVIlwefH6yUd1QHdATMh1Vmj3iNbefWC1MhR5MMUNE25A9TWkNAiac 3Nyg== 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:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MYg5m0atdOw1dxzpeo8zRV+fGD2ca4bGE4Ou9GGosT8=; b=EU1oGdPds5pxgMNsI5UOJjg6Q+u6WWArHK5cYVrMkm2iS7BFsrePxRZvw7Iej7YubH utkXciqHLy4iXmcqVdlYug2PtTTC0rdPCrGyS45D0oP6lWSsngG9A5iGuI7JDr6vj/Lo 9CGe6OCJ8m52X1QKiWasAksk6RtExgSe31D7zrrwqnHX39IqZrtLulHaGNWeiaR6ol3U XB6aVlAPTMbndPKKYghHbjBUZXibMWisDxtRPJw36RdQ6N7aV0f7WZbQbM45AgX34s76 e0MBpYCWpqdJoEHnyhwLvbc0w7UjJ20y8OE4GrsoMWDxqCsNufjtdJV8pABDD8Nd8GcZ SNvw== X-Gm-Message-State: ACrzQf2IdmPpvAIeQCiJ8gHIX+Gs/VwBWM/GNq+j0tDaBQG4UWNdbgun IYEDVj6k/+r50/AOjeBbLmk= X-Google-Smtp-Source: AMsMyM5hw6qls3PUCHGF6uCN29DcI1jmEzoJ4z1WkLKabSqkaQDHErMVb3uAq5TMH+SGFZF7o2YneA== X-Received: by 2002:a63:8741:0:b0:470:ef2:6f11 with SMTP id i62-20020a638741000000b004700ef26f11mr34654684pge.455.1668030947625; Wed, 09 Nov 2022 13:55:47 -0800 (PST) Received: from google.com ([2620:15c:211:201:8514:5da3:d38f:7bd]) by smtp.gmail.com with ESMTPSA id om8-20020a17090b3a8800b00216df8f03fdsm1682431pjb.50.2022.11.09.13.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 13:55:47 -0800 (PST) Date: Wed, 9 Nov 2022 13:55:45 -0800 From: Minchan Kim To: Nhat Pham Cc: akpm@linux-foundation.org, hannes@cmpxchg.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 v3 3/5] zsmalloc: Add a LRU to zs_pool to keep track of zspages in LRU order Message-ID: References: <20221108193207.3297327-1-nphamcs@gmail.com> <20221108193207.3297327-4-nphamcs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221108193207.3297327-4-nphamcs@gmail.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668030949; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MYg5m0atdOw1dxzpeo8zRV+fGD2ca4bGE4Ou9GGosT8=; b=eb449J6NP1qEkrbo4hXutmRLE5Z4Dnrxc6n6EeByrmVaavP1nZBXxiRHvkfugWAIKJNejh lugEs700Yqcv7SFx194a9yGZ0rdxU4porUN9F1s9lhauV024MXhcKCjpN7t1j61QokXpi5 +H9SL4dygdY33b2UFTQU1LqokVT4bVk= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JZ1aEngm; spf=pass (imf26.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.215.182 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668030949; a=rsa-sha256; cv=none; b=aVPy/bUD/zzHYJetcQ26k5PRv2J3zn+7bydyuBWTQ+AxmKP37DU8bSPjYcFFnkZI6iMEo0 VGHDs2YpQKFmTr1h4fjOqfAn45rZcXl/lrBsX69SudHgFMtBXJtQ35iY9a0LpkZfwSuVxm fKsLl1SfQu4vo5bWDjZjQqI6noFu+M0= X-Rspamd-Queue-Id: E3E5E14000A X-Rspam-User: X-Rspamd-Server: rspam08 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JZ1aEngm; spf=pass (imf26.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.215.182 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) X-Stat-Signature: 4pq85fkto8h38hhxii1cmthrqh6ubnwj X-HE-Tag: 1668030948-915275 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Nov 08, 2022 at 11:32:05AM -0800, Nhat Pham wrote: > This helps determines the coldest zspages as candidates for writeback. > > Signed-off-by: Nhat Pham > --- > mm/zsmalloc.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c > index 326faa751f0a..600c40121544 100644 > --- a/mm/zsmalloc.c > +++ b/mm/zsmalloc.c > @@ -239,6 +239,9 @@ struct zs_pool { > /* Compact classes */ > struct shrinker shrinker; > > + /* List tracking the zspages in LRU order by most recently added object */ > + struct list_head lru; > + > #ifdef CONFIG_ZSMALLOC_STAT > struct dentry *stat_dentry; > #endif > @@ -260,6 +263,10 @@ struct zspage { > unsigned int freeobj; > struct page *first_page; > struct list_head list; /* fullness list */ > + > + /* links the zspage to the lru list in the pool */ > + struct list_head lru; Please put the LRU logic under config ZSMALLOC_LRU since we don't need the additional logic to others.