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 B2E79C4332F for ; Fri, 4 Nov 2022 04:03:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D4FC6B0071; Fri, 4 Nov 2022 00:03:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35DBF6B0073; Fri, 4 Nov 2022 00:03:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D8F86B0074; Fri, 4 Nov 2022 00:03:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0FB626B0071 for ; Fri, 4 Nov 2022 00:03:07 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B185BC0508 for ; Fri, 4 Nov 2022 04:03:06 +0000 (UTC) X-FDA: 80094414372.26.29CEE48 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf24.hostedemail.com (Postfix) with ESMTP id 4EF17180004 for ; Fri, 4 Nov 2022 04:03:06 +0000 (UTC) Received: by mail-pl1-f170.google.com with SMTP id u6so3784927plq.12 for ; Thu, 03 Nov 2022 21:03:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=a1loK7ln7Hij0cyr/UscwcFeEgvc2r7/YpHlh6hYwV0=; b=g6q7D/fZTjK71kCf1Zpq3gH90C7KTwReQbFPBMIl3dMGBsh3gM6ms2wcSp6Zr94wX3 hh+JW+K7+l++Uuu14kBRKZkNcY/kG7Hcbcv+a32D/Ier9tOkVHKYUXy4SXqhkNOGKNy4 7nM9Y/y7al3ydpjxZqG3J8eIR3e8QCmBlWNGY= 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=a1loK7ln7Hij0cyr/UscwcFeEgvc2r7/YpHlh6hYwV0=; b=b+AxVnW6R3n4a9qwb0udwEumpQzQIt/bRNo6c9IgnWwEFPtQPC2eSbX3IQ4a31G8jt nZst4fUcfQCS7CFTiDrdRWjA0Ar4maGMa7LiLkqvoYlXr8+Mg4atrqCVRqQvOCxg7yYG Ia9+I3uptw2nt63rx1hDJGanMZZ4kxt0GfQoGgiJ2q1qYz3SZy09d/x60a/J+ILBK6md YRWbvn/sza6ufBZQ/Si4wUYI/6h+HJQJTUpET5jeoqJ9/YGo0VXjwJRVzk16N/r4em4d SW2CPFLeqi72gusnygxCMZWQWuSdNXg9VXyxNI0OR//TNcqQeOdsuXdEPxuEhaylewb1 xf8g== X-Gm-Message-State: ACrzQf1Muf7S0LRGkVd+XvmTXkZWTcBzOV4h1D0f7ZXpExeeW8gxJBRp hP4V4mmjhLRZTu7nr0WigkjLdg== X-Google-Smtp-Source: AMsMyM4V0UeLmQDFUWvKWnUjdFyJBMuOGsdUSkSqQJ1xqCIqojqCTcjDV2sZAoDSocwg0mrEkCC8FA== X-Received: by 2002:a17:90b:1252:b0:213:beea:80c0 with SMTP id gx18-20020a17090b125200b00213beea80c0mr30981536pjb.169.1667534585374; Thu, 03 Nov 2022 21:03:05 -0700 (PDT) Received: from google.com ([240f:75:7537:3187:f2f6:8f5:87c8:3aeb]) by smtp.gmail.com with ESMTPSA id c18-20020a170902b69200b00186acb14c4asm1492301pls.67.2022.11.03.21.03.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 21:03:04 -0700 (PDT) Date: Fri, 4 Nov 2022 13:02:59 +0900 From: Sergey Senozhatsky To: Johannes Weiner Cc: Sergey Senozhatsky , Nhat Pham , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, minchan@kernel.org, ngupta@vflare.org, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com Subject: Re: [PATCH v2 5/5] zsmalloc: Implement writeback mechanism for zsmalloc Message-ID: References: <202210272158.7swYwd23-lkp@intel.com> <20221027182736.513530-1-nphamcs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="g6q7D/fZ"; spf=pass (imf24.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.170 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667534586; a=rsa-sha256; cv=none; b=oCh6iOR7bJgKs2k//wrCry1O0CUVYIp3ti12mxvh9DgsfEf8Ap1nxb0W9GG2eoq2qThf4S pwQlqTIzcq3EwYMHUs6WaJa8c1x3fjZVbXgS9Ob6Fv2fAMcK7dke9Ob7DV08AKJGnHQ0g6 cmCtwnduulckMdqXJeVagI5aT9ScVow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667534586; 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=a1loK7ln7Hij0cyr/UscwcFeEgvc2r7/YpHlh6hYwV0=; b=rtvlAvgLImeSHJwu5VTbzjUB2aTEb5UlZzWItTHWbWDVsRwzsixF8hZjXVy8TCPWXjEjkp 62MHF4vO/tJhT9MHxKSggwTzncZL2rMXxB/ls7ATMXE9BtRjScnAZMPjq1pFTorNQgDTmc yqMSSj5xfXc3dKOV4ZA8WefNfJogScg= X-Stat-Signature: o4q5zs6oykk9uc1ahszd13x3a9rxq4eh X-Rspamd-Queue-Id: 4EF17180004 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="g6q7D/fZ"; spf=pass (imf24.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.170 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspamd-Server: rspam03 X-Rspam-User: X-HE-Tag: 1667534586-648466 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 (22/11/03 12:45), Johannes Weiner wrote: > On Wed, Nov 02, 2022 at 01:13:58PM +0900, Sergey Senozhatsky wrote: > > On (22/10/27 11:27), Nhat Pham wrote: > > > + > > > +static int zs_zpool_shrink(void *pool, unsigned int pages, > > > + unsigned int *reclaimed) > > > +{ > > > + unsigned int total = 0; > > > + int ret = -EINVAL; > > > + > > > + while (total < pages) { > > > + ret = zs_reclaim_page(pool, 8); > > > + if (ret < 0) > > > + break; > > > + total++; > > > + } > > > + > > > + if (reclaimed) > > > + *reclaimed = total; > > > + > > > + return ret; > > > +} > > > > The name collides with shrinker callbacks (compaction). That's a bit > > confusing, took me some time. > > Yeah this tripped us up too. > > Unfortunately, this is inherited from the zpool API: Yeah, sure. I don't ask to rename zpool API, that was just a personal note that it took me sometime to figure out that now we have two different shrinkers. > > > @@ -482,6 +504,7 @@ static struct zpool_driver zs_zpool_driver = { > > > .malloc_support_movable = true, > > > .malloc = zs_zpool_malloc, > > > .free = zs_zpool_free, > > > + .shrink = zs_zpool_shrink, > > There is another terminology collision around "compaction" and > "migration": There is zs_page_migrate() which is called from physical > page migration and compaction to switch out backing struct pages of > the zspage. Then there is migrate_zspage() which is called from a > *shrinker* through *zs_compact()*, and it consolidates the objects > from partially used zspages into full ones. Oh, yeah... > We're collecting these issues and want to clean them up separately. It > seems this codebase hasn't had a lot of TLC recently, which makes it > harder to make needed changes :/ We try to clean up as we go, but some > of these issues (like the .shrink callback) run through all backends, > zpool and zswap, so they'd be better off in separate cleanup patches. Totally agreed with the separate effort/patches.