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 6E0B3CA0EC7 for ; Thu, 29 Aug 2024 23:07:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD44F6B0085; Thu, 29 Aug 2024 19:07:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D83816B0088; Thu, 29 Aug 2024 19:07:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4B4F6B0089; Thu, 29 Aug 2024 19:07:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A42876B0085 for ; Thu, 29 Aug 2024 19:07:11 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5BED8140DA3 for ; Thu, 29 Aug 2024 23:07:11 +0000 (UTC) X-FDA: 82506820662.01.0CCC89B Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by imf01.hostedemail.com (Postfix) with ESMTP id 7AFF440018 for ; Thu, 29 Aug 2024 23:07:09 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=1wLoC4jt; spf=pass (imf01.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.53 as permitted sender) smtp.mailfrom=yosryahmed@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724972784; a=rsa-sha256; cv=none; b=UyEkAJNoYSygwE+0+SDh8DdYouCLMD3jZ3Gibi6Op9FhciwF5UKkEwyfKqo/+OpG5DiUun SePGLgsKRAdXHCV3b3f9A4IfUSjh2yVCRpqa6Db64FvPNIqs5UYiEsiLEQOcWMTCtLR3ic mx5dIGIit3URvgttHn+JyDkHkaNN+iQ= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=1wLoC4jt; spf=pass (imf01.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.53 as permitted sender) smtp.mailfrom=yosryahmed@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724972784; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IE1sZPv1Wc55CtZJy5IzEWkbJLLw6KHnbAqmMk/YArM=; b=OY/DjjluDFE84ys/z6B1sfV53Mkrwpl3tDPA/l3ZdTUcKEXyTvm21hzKfyngwNwfneKyhM U9ijEagonzRYr7nomW4aAX6eZoxYYY9uCdSkj37VbaRAwsO9ynmeKg1mHyqRAZVvSP+imA GHS4jbfKeIGE/RU29Hq/ThhQrUtSmo4= Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a80eab3945eso120746566b.1 for ; Thu, 29 Aug 2024 16:07:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1724972828; x=1725577628; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IE1sZPv1Wc55CtZJy5IzEWkbJLLw6KHnbAqmMk/YArM=; b=1wLoC4jtt+czeO80Twvj81Ir1jLqNGon8VWJ4rJMpiUX4F2XPMljnR9yJkAcbHASxu zW/g/UUkPatmvGsVbe3DT4a0vjRla/BfjBVzIsNcaND5K6+lUTjhNz4UlFbUitkc3LA1 TusVbCf3u2ortXM0PwLYnBeFsYkm8JNEhSZvSRcHteGBORJAOGr/515SouSY0BOnbAmN qQvcVeI2UVVSxF8sqSgT+e9hDmYoCct3nKOLxnV+upDdtVua7A7OsvF27JVd2ukYsiJy 5RaDmCFI6/jQbbZu+Y0TGCWpSzQxyfzAbDwm5KwYERbrEECmCWC4c04YfAk7KmSXpblH Z2aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724972828; x=1725577628; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IE1sZPv1Wc55CtZJy5IzEWkbJLLw6KHnbAqmMk/YArM=; b=czRLXd4KlBSANeSNliWHJgfCKgd6HIIyB3TUhLHbOETyKdlhyuf/b2nwnR4sgatkc/ zDis5BvYikXXmYmdjsBIgQ4wRgrBhvGjTLxYye1omE8WoO8ncGfqQrRIywdQXkodFTpJ /VsAMh0rHkWUSQfvF6JdqrCn4U6xj0mDrecAn7KIxpYcR2hEq7W0eFrL9LQTzk35fKC4 QH8oobSXlQGcYjgF/vP/b8tcLmHvqGSvS1e7c7y5nEBVn+DFUfJ79u16g+U/lumHb+yv xekvLmD5Ce0nv9kzmoU4919nsOw3p1K6PZ/polgA0kfujTub5W03Fallr3OrWIKSXp0Y KUQw== X-Forwarded-Encrypted: i=1; AJvYcCWD8YiF6QnTPh1tpvTA5uBCGXPhRiuzlQL6PkGmEzmUu91uqpYYhA29ZxBxNZ1T9Wg5EuFRq5ZNnA==@kvack.org X-Gm-Message-State: AOJu0YxIt2V6gWUn1f0FDCBxpkR31D154io4jsMj7pzw9rgbcvYZQDOb /hOpz+UYtJWjmKnvkrcdQCiBdWAUBIBzQYKo2Gf00STAOmU8jI5MVb+OO/hcsm9wzbhH3sZ3wXK K/bZqtJNalGhZqMbrNYKirE2Kv9hlmO5uK8mj X-Google-Smtp-Source: AGHT+IG88iTCuGLLGxY8Mp4Ww63+WBxvpC4h/iGsfnx1ufWFs2ff22EPd84RvgFNCoUJUOXuIRlS7ub5Q0qKfPNKXqk= X-Received: by 2002:a17:906:6a25:b0:a86:b32f:eee6 with SMTP id a640c23a62f3a-a89a3820bd8mr17782266b.54.1724972827094; Thu, 29 Aug 2024 16:07:07 -0700 (PDT) MIME-Version: 1.0 References: <20240829212705.6714-1-kanchana.p.sridhar@intel.com> <20240829212705.6714-3-kanchana.p.sridhar@intel.com> In-Reply-To: <20240829212705.6714-3-kanchana.p.sridhar@intel.com> From: Yosry Ahmed Date: Thu, 29 Aug 2024 16:06:28 -0700 Message-ID: Subject: Re: [PATCH v6 2/3] mm: zswap: zswap_store() extended to handle mTHP folios. To: Kanchana P Sridhar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, nphamcs@gmail.com, chengming.zhou@linux.dev, usamaarif642@gmail.com, ryan.roberts@arm.com, ying.huang@intel.com, 21cnbao@gmail.com, akpm@linux-foundation.org, nanhai.zou@intel.com, wajdi.k.feghali@intel.com, vinodh.gopal@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: 1x5afb9ggt74et1f9eejmfrtd9ytmdse X-Rspamd-Queue-Id: 7AFF440018 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724972829-201562 X-HE-Meta: U2FsdGVkX1/vEWg69bHHalZDxZCDqD/MIapd28+O/2jcfZGEESHoTojomlnag5ndwd0bGLGXO43yORbeImE5VzlrAa9EPs/cOuNNRsR3veez3FbEpxcvjoVim2QI4g6Ky8K/d1BGE/OpmunVXCj0+ruuoRuq214XYpWWZgwXpfo5nElYQzhvYiKdxL6FQaqW8+Oj/hz+1NvXM0JSPfkV/ZpxHBQ1OrxqGPq5tcU9J8IdlgTWf8jYqcovgtdcKcyxQZktF5bS02y01gdUwOdZu9J7XBM+IaohHQ10Nc/nul5RFTwyGe7rmpqmzL7daen+oW0OPb99f8XbvHNPV3U54xJ0R4tQdFHFXnz5R+2mBFt9xUqKunMLMVgCsGaHIthl8x2L0t9I5PEMFMkG/QLLidf1VIf/w6JWG11Kpf258BX3SlvIAHZmTex+2lxZUzf4ARQ1IARG+FoeTqm8xX0nHMeStPJIjmsCFE8y9NiTtYw0jnztenYV0UZVklYc5CoiDViMvucs2eWI6Uad4qCRPqRXxuqz38c1OKrYM334of3KJv+SCRygGwbW4amd1ytckG71H6mTB/hlQw3mbWDcRV8QKTnIyajuo9EI85cMOvWG+zJt/ulNnEIjEWIR52bqFEU7IcFbTgScBFExv/4XtpOOzPkJGCEvEOf4HhmpgeuJTWIMxf7vKufC1JccAV4U4xVVPDr0m2DWBYoF1RrKOm3fZj85gBu5O+tlp2t9OG8Q9rjxB9l1SYz5eSs8dLShsh2qEp5Mp0xgtsIYpYxLNjDnOTJbgJOZR+4/Meye07TEmf0JeQ/aJFqpv37VyOYnTikifUSHfoxkPu2ul07ZeRObgKs5TwjRYckCSKtZDG1Ri7NosrS4aJdAHSFxxoOLTAvhRwJmspALA/1dX243Cv/sKgvFo6o2nlsoD5bzKpW/icsXsWn6M56hhr5n1IUWHL25T0ZOCJ7W8Yc4U3H LbRG5wCv igfdFDC7fEFdomQn8CWAomPtB6L5NuB5Cr1y746vOMxlnXJA0SRA1yx0yKBHkiZoLGpVhCCRDmNITz80C/3soxis/Hkuxb2JBEJgv2RQ25gLRokqTBl+SJI4zth1bf57j5S3p5R0009C6Fi02v1y9UTfHP2GE47U4R6wSi/XwvXzqrsj2bL3kEmdwzkywHFdR0b4F4yIOo69aNGA2f9JJL3m8HBa5hswUdOflBuHs9EIt/lwt921krpYALIgbWbtvLyoptYKh927MIkdNTTMegUSTjFtIiyD21eSHjv7/fSBIDyph9kn+HQH/OV8TKZALB1zKtYxPKNiY10N3bct5yPXjWS0HRmeRPx5qtWj+1/kUbIU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.001681, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Aug 29, 2024 at 2:27=E2=80=AFPM Kanchana P Sridhar wrote: > I think "mm: zswap: support mTHP swapout in zswap_store()" is a better subject. We usually use imperative tone for commit logs as much as possible. > zswap_store() will now process and store mTHP and PMD-size THP folios. > > A new config variable CONFIG_ZSWAP_STORE_THP_DEFAULT_ON (off by default) > will enable/disable zswap storing of (m)THP. > > This change reuses and adapts the functionality in Ryan Roberts' RFC > patch [1]: > > "[RFC,v1] mm: zswap: Store large folios without splitting" > > [1] https://lore.kernel.org/linux-mm/20231019110543.3284654-1-ryan.robe= rts@arm.com/T/#u > > This patch provides a sequential implementation of storing an mTHP in > zswap_store() by iterating through each page in the folio to compress > and store it in the zswap zpool. > > Towards this goal, zswap_compress() is modified to take a page instead > of a folio as input. > > Each page's swap offset is stored as a separate zswap entry. > > If an error is encountered during the store of any page in the mTHP, > all previous pages/entries stored will be invalidated. Thus, an mTHP > is either entirely stored in ZSWAP, or entirely not stored in ZSWAP. > > This forms the basis for building batching of pages during zswap store > of large folios, by compressing batches of up to say, 8 pages in an > mTHP in parallel in hardware, with the Intel In-Memory Analytics > Accelerator (Intel IAA). > > Also, addressed some of the RFC comments from the discussion in [1]. > > Made a minor edit in the comments for "struct zswap_entry" to delete > the comments related to "value" since same-filled page handling has > been removed from zswap. This commit log is not ordered clearly. Please start by describing what we are doing, which is basically making zswap_store() support large folios by compressing them page by page. Then mention important implementation details and the tunabel and config options added at the end. After that, refer to the RFC that this is based on. > > Co-developed-by: Ryan Roberts > Signed-off-by: This is probably supposed to be "Signed-off-by: Ryan Roberts". I am not sure what the policy is for reusing patches sent earlier on the mailing list. Did you talk to Ryan about this? > Signed-off-by: Kanchana P Sridhar The diff is hard to follow because there is a lot of refactoring mixed in with the functional changes. Could you please break this down into purely refactoring patches doing the groundwork, and then the actual functional change patch(es) on top of them? Thanks!