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 2BE07C4332F for ; Fri, 18 Nov 2022 23:22:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BDE7B6B0071; Fri, 18 Nov 2022 18:22:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B8E906B0072; Fri, 18 Nov 2022 18:22:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7DA28E0001; Fri, 18 Nov 2022 18:22:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 987626B0071 for ; Fri, 18 Nov 2022 18:22:47 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6ECE71A0461 for ; Fri, 18 Nov 2022 23:22:47 +0000 (UTC) X-FDA: 80148139974.18.E618526 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by imf05.hostedemail.com (Postfix) with ESMTP id D83C3100002 for ; Fri, 18 Nov 2022 23:22:46 +0000 (UTC) Received: by mail-qt1-f179.google.com with SMTP id w4so4192800qts.0 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=kvRC/fWI0CnfnLkGBSoHpNXA7/CrFmhx/wNS16UAQEplsfDK9heD6m/4HQ/rxOrBgR e74vKE1AmJdhEPNp4uPAcWrLbCwViSs23KKfC25QG6EohBxYgSRmqkByK7tYWIlpQv5l ZUSpEOciltHDw49e06vAYz5UoV7OMR5YhaQRn7IzuLMPDgbhZoXuJj0EhQ8qoZRtbEDg WsrpY8odLKM0CBx0GzsEk695uQggFblRYni0aEi8e3WXWerYmyOUR5aebj/MkLCY7Xo6 9IYYxHiL53GbCYIkduRkx2wgJMl3KHN1BH2Tk1acYMBgbaE/bUeR2j0RY8K0iou9/69p 1a4g== X-Gm-Message-State: ANoB5pli5PNKQYUwDkyEmuBooPvONmNvqDp5RShwsT3cgkSZDKyXth2W P32GBu/g0X3mCwlvfMv7flz1cA== X-Google-Smtp-Source: AA0mqf4Lax1B626EO0404yB6hsv9w/QkDTAth8qheZdYexzp5WcpdsNEENwKQG2bnhqg75Um2kQsiQ== 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: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668813767; a=rsa-sha256; cv=none; b=r4OSdylTAYCePX5RWfmMdXJnor7m4sExvaQVEenQrAgjlu6uPkLnPvp7etptnI+uTg7y/g KgabivP8GYiw44NG2S2huNNi+9ML+mzL/cs8jqXml1rlADVsX2F/r/mvIL9vMJkuOPpEPp 9wtfoRlF3iuYd7t6pZS+QiNwDwcFMCM= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b="75OTZs/u"; spf=pass (imf05.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.179 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668813767; h=from:from: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=JTPRlJSX2DLHg3q6WEUslM2aHDz3cJkv4J+i/NOGxF8=; b=nSKvxP2sbbIyTnNX+2NFLEnWKTRC80Do3kZNK0LR3UJJZeiMEV8g1ftIMb3HzGI1D3jHDc Kgy2j/73z00sZNM+qvK6uCsOEIwmMTDRp8jxj2PGOBxUfi9j+dDE1ec5l00o4lTpSB8hp0 /ipBjpZ2BZ/JCTf5ghTDrvCvTDBINK4= Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b="75OTZs/u"; spf=pass (imf05.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.179 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: D83C3100002 X-Rspam-User: X-Stat-Signature: usje99dgzdsdj77uyhbh77hkcabk9iuq X-HE-Tag: 1668813766-13034 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 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.