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 D61A9C4332F for ; Fri, 18 Nov 2022 21:35:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 529FD8E0001; Fri, 18 Nov 2022 16:35:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D9076B0072; Fri, 18 Nov 2022 16:35:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A0908E0001; Fri, 18 Nov 2022 16:35:05 -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 2A9A26B0071 for ; Fri, 18 Nov 2022 16:35:05 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EE6741403B5 for ; Fri, 18 Nov 2022 21:35:04 +0000 (UTC) X-FDA: 80147868528.07.5AD0ADD Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by imf23.hostedemail.com (Postfix) with ESMTP id 78F6214000A for ; Fri, 18 Nov 2022 21:35:04 +0000 (UTC) Received: by mail-pg1-f173.google.com with SMTP id f9so1862841pgf.7 for ; Fri, 18 Nov 2022 13:35:04 -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=SlURkaIkyM/L0R6Qo7JiH0N7DN4WgUDEtFjAiaM+3Hg=; b=E+89iQFvWsm/dYStxTy1p50NxPbkEC21OJNKdRLnYxscmnzr4o8jee0C56/8hbFFbx latrROfoVCq7eJ+CowWUBxEbWfb+9QAYjQ7lnhRgNTAXHdOGcBU860ocmVIsA2dgjx9P hclBlWxQoLoJg+7BxHe6oNXNz5WyoIU1jx6BXNhVf5qf5f/7s6vQkE0bu2Zj54GJx1GE AAN1wkqT4hUK2yd/h1lFeyZGMbUkmWt+fK5JkbR5x6VQk8gqHmzTDjPwhV22wxFwvou1 Q3MSU7xXHJrZyGPnU0tyRIhg1r/xLbWGgyUj0WjLuCo6j1vgLzK+rtZfd1TVbvylMZCq oOBA== 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=SlURkaIkyM/L0R6Qo7JiH0N7DN4WgUDEtFjAiaM+3Hg=; b=b2N3PeFMNQAGgiSF8JzsT7LsLE+H7PS7sYS/KifRHYuwXguLMAWT9l1tW9yS0AIMCS bn8CzdesA0rQkZp1oCpBfF8RYuPs0rqgKrA7wxzR73FRcNUP/MBrfAwiUDhgVIuad+Qn vAxHAPH3XK+VczVWzgDdEEpp+WXqPw32nHUro4B2PI47io5o1TV4L1GZbMMmvW+R+RZb 6W+AuF3KUJpCK0VnK/dMCJ/ASGKBBwbnsAbuEgw45zHSZs3CScUVEOSDcE2dD8lS21eh io8zLMzHhZ1At2oNjvY4qpWWvs4gghe5PkUupmPseqD797Dypj0SVQW3bbQNoPbLoz9l LYVQ== X-Gm-Message-State: ANoB5pmuHn8IhngDUNV11R4b3V+BJgOhU5bPQVcrL8Mjy5wpq84qSRQO nTTE4ySpHswjs91krYEpuZM= X-Google-Smtp-Source: AA0mqf7b+VUxMrDj2BqA4zvdsg4N/uHejeliIhBO/+a501WGCoOxiSV93/5vTCyi9XVd3o9u08eF5A== X-Received: by 2002:a62:19c8:0:b0:56b:f390:36f with SMTP id 191-20020a6219c8000000b0056bf390036fmr9852779pfz.2.1668807303411; Fri, 18 Nov 2022 13:35:03 -0800 (PST) Received: from google.com ([2620:15c:211:201:bba9:9f92:b2cc:16a4]) by smtp.gmail.com with ESMTPSA id g24-20020aa796b8000000b0056c814a501dsm3774521pfk.10.2022.11.18.13.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 13:35:03 -0800 (PST) Date: Fri, 18 Nov 2022 13:35:01 -0800 From: Minchan Kim To: Johannes Weiner 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=1668807304; a=rsa-sha256; cv=none; b=ffRVPFRZIGTVxBgdqwpL1CPWwGSwG3npr0g/BDp5YfbLYjnsXH2aZX3UP33xuQAIn9jEp9 eYEEFRa7xzeuwmqPuE7mqK1TE7fJbuyCpFn1o1cvJLeWPMk2cCPk9/70eLdJE1sq/Ln5Jf yy8voDl5urCrDCI1PWQzNJGLsISf65k= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=E+89iQFv; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (imf23.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.215.173 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668807304; 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=SlURkaIkyM/L0R6Qo7JiH0N7DN4WgUDEtFjAiaM+3Hg=; b=UHOWEHWPAYW+mYK2QaECQiauLdvt83/yi1Hh2MGqs8ZzgH5rJnAU9/VE/RpP+JOry7hHEU m9oY94IuZDP9p5iBP9QhyWDoIt3h5mrU+yENS+exdSq03J/zASGJ1noSQYxUzvbKmtcOev 1wnTMxq8yeIqb98CgoqkkPq/MPS07z0= X-Stat-Signature: h5dnoxuj1p7wagnd1eaarfw5c6c63fb6 X-Rspamd-Queue-Id: 78F6214000A Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=E+89iQFv; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (imf23.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.215.173 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1668807304-257934 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 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? > cleaner or more generic, just weird in a slightly different way. > > On the other hand, it makes zsmalloc deviate from the other backends > and introduces new callchains that invalidate thousands of machine > hours of production testing of this code. Do you really believe the trival change makes invalidates the testing? ret = zpool_malloc(entry->pool->zpool, hlen + dlen, gfp, &handle); if (ret == -ENOSPC) { zswap_reject_compress_poor++; goto put_dstmem; } if (ret) { zswap_reject_alloc_fail++; goto put_dstmem; } buf = zpool_map_handle(entry->pool->zpool, handle, ZPOOL_MM_WO); memcpy(buf, &zhdr, hlen); memcpy(buf + hlen, dst, dlen); zpool_unmap_handle(entry->pool->zpool, handle);