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 E66BBCEACEC for ; Tue, 1 Oct 2024 17:04:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 778AE680026; Tue, 1 Oct 2024 13:04:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 700C3680023; Tue, 1 Oct 2024 13:04:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55487680026; Tue, 1 Oct 2024 13:04:30 -0400 (EDT) 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 2F360680023 for ; Tue, 1 Oct 2024 13:04:30 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8AE2EC17C2 for ; Tue, 1 Oct 2024 17:04:29 +0000 (UTC) X-FDA: 82625657058.14.F489A16 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf16.hostedemail.com (Postfix) with ESMTP id AF40018001C for ; Tue, 1 Oct 2024 17:04:27 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Qwr9ILkP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf16.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727802228; a=rsa-sha256; cv=none; b=NmvRnPzSgjuTJUF4lq9j6J3hdIEYA3+CLJRMy2sWmnul+Uo4dIcPj4+UFVloSnAj+unl/L Xvdwp9j9CiAoAq6eeHCIkpkr6Rsmw/LFQZW/heirjgoFZ6dptDXRoEV26SXYe56eU+is6K Ti2zYiNFuuqPyKkR6GGUV3KZlzQD7sI= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Qwr9ILkP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf16.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727802228; 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=Me1FX2lppyIL/j5P9cOe/gDvckfgLnvmXcT9GxnrPYU=; b=e2wmmWn/9rMorH4XcmlAYxDEJ51VipHqDODCbdnDgRojd1JODzrAGCfZgX3635tCwZZabn VBCBf3LI+L0+oYfgruR+PwO5hF+ZV726ppB8+nMY1ofTPXWqLQisHjSTGH7tx6emTZo4O8 4MQxexYVqGTt9rThxqm245ZlMJz74oc= Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a8b155b5e9eso53382466b.1 for ; Tue, 01 Oct 2024 10:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1727802266; x=1728407066; 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=Me1FX2lppyIL/j5P9cOe/gDvckfgLnvmXcT9GxnrPYU=; b=Qwr9ILkPgoXlw+ev/eJOsvHs4r0U1r3tdJ2CpG4+W8oz9gM5ZnxOwc7v8l8R2z/WWY 8ukZGCNVPiZZuUblgI14wHWF3jrD2vNi6Y74t0c0E2yzriXj9H3D0DKIWCINRYyS8hf7 oY6ADtPb17bfVtuyXcHc+NBbNgfELn7wMwj6yG6cmAv0pgYJ837mi9eflgeeA606cXeX wHONHjvA4+jcyREaxNY+d3shdu/czKQpWYl0KBsMBJbv16vpo/9YXEbLVaDIyBsSCaCG Lq6t1vXYr0wz0Ou+P5EHEE6UP/JbCkIlx/r7j5NZhDnAJfHEtdiNzbPf1642qa4BRb3u 2dSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727802266; x=1728407066; 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=Me1FX2lppyIL/j5P9cOe/gDvckfgLnvmXcT9GxnrPYU=; b=kv1ZmOnyrSUntrsRcnVx2S35tM1HOy3o+99LjkJy9N02zr10D+EpO3eOwoqA6oY4AE 9vruESWvOBB/Vnp5mgbaop2UbB3gJPPlMHJNtyyY9CeuSMz2VDb8KJ3WaAWrm0LFcW+Z +dJ9iwFshA8M8jmeoSO+QXh5FTQymzfYRoTrFm6q3vOmWjNTh++hSSqaSOsq7CiLc0kc duuR++keodi0hmjHcCsJazWlmV30Y0xqsDmU5wZkUpXw71ErbuZf5DWbsKGg3C3v+IU9 qR/26PGNedCvgdw25E9ttv0L3CMTeZFC1kKk0kLXo1L1/WEJJTufk2+kO2KTeJlSYPau Zmug== X-Forwarded-Encrypted: i=1; AJvYcCVvmn68+LgZtUYC8O5xW2jLynFgcYggrNZtmRWpofGmPC2OuTgoKR1rtPrcz4dFk9xYWsxNK6eqog==@kvack.org X-Gm-Message-State: AOJu0YzNWgnaBA3YLLU3eQjTnZzTZoYA6LF996nEQ1tAO+hPXiFolZeT 431Wh8EUKP2hKQIvhx0A6KRAfRDNu1nwh5cZvGtKvq9bxd8AB4xXAV3+lIr6L67JaYTp2cOk8NF D3IXe50tNm0zMA15Oao60JSHjF8QXp55Fg15EoZ1sB+3lTODpqg== X-Google-Smtp-Source: AGHT+IGWt5bne4oNMH07QjwYPIuXsLAedm9zyIphbqhDR20VgwILmh2dIAAEPKSAwK4+Ick9yHCoxti2CBBAb44dRIQ= X-Received: by 2002:a17:907:3181:b0:a8d:2a46:606f with SMTP id a640c23a62f3a-a98f8268e89mr19569766b.38.1727802265852; Tue, 01 Oct 2024 10:04:25 -0700 (PDT) MIME-Version: 1.0 References: <20241001053222.6944-1-kanchana.p.sridhar@intel.com> <20241001053222.6944-7-kanchana.p.sridhar@intel.com> <20241001111045.GA1003400@cmpxchg.org> In-Reply-To: From: Yosry Ahmed Date: Tue, 1 Oct 2024 10:03:48 -0700 Message-ID: Subject: Re: [PATCH v10 6/7] mm: zswap: Support large folios in zswap_store(). To: "Sridhar, Kanchana P" Cc: Johannes Weiner , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "nphamcs@gmail.com" , "chengming.zhou@linux.dev" , "usamaarif642@gmail.com" , "shakeel.butt@linux.dev" , "ryan.roberts@arm.com" , "Huang, Ying" , "21cnbao@gmail.com" <21cnbao@gmail.com>, "akpm@linux-foundation.org" , "willy@infradead.org" , "Zou, Nanhai" , "Feghali, Wajdi K" , "Gopal, Vinodh" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: AF40018001C X-Rspamd-Server: rspam01 X-Stat-Signature: hxo5rqobenwfh6g43bcbko1xzwu63esf X-HE-Tag: 1727802267-178823 X-HE-Meta: U2FsdGVkX18lrkpm724NNqZk6jYlBABpbk5VEiC83RM+tLyObzOn8fBEDPmrteU4VQDR8reGW0V+a9hD4ACUnMg+1mfmrbHe62UA5QM1LeczRWdaO6nWwkDbTZvrjpg5oWTzRJWg3ov9sCNMglA9zJZRTxFkSxF9B5aAs/u5ehlObUsMSmgfOvji3Yxxgs83xPzH3jbTjwwJ9CPm/dXFNRjF3d5aR6/OG++k6kObT2Th8la8pklP28lzEbyrpgyYpEmcrGbA9WtZNEdQFym+xYwTRgXKc0MiLBVle6ch6Bb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w1nJcc6uaBhTVvrSWOnG+x58yzR+ChEhOiUdIPHaI6SQkVAtO/veAQQde1O09aF4SdyYC+FAt2YsrpEgOij9Er1RmMb85uMWxdPkK0oUkSEF1p1eOVgOqLmp5kopUC4mjHyq4QC+U4uiAZwFGEHO780o951PVY7qqnRYkIb+8JxPITcv9eIf266qcYiIgRiivQSp6JuNEEDv52uOaJxVKmcEJhN4T6iHY67Uxv4GxLMbUMKzZYInjhKQTgEfy9vhgW59r/6EdaxTZ2XtWSeIH6QjYYkAhBEQbFmw4zaY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.001320, 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 Tue, Oct 1, 2024 at 10:01=E2=80=AFAM Sridhar, Kanchana P wrote: > > > -----Original Message----- > > From: Johannes Weiner > > Sent: Tuesday, October 1, 2024 4:11 AM > > To: Sridhar, Kanchana P > > Cc: linux-kernel@vger.kernel.org; linux-mm@kvack.org; > > yosryahmed@google.com; nphamcs@gmail.com; > > chengming.zhou@linux.dev; usamaarif642@gmail.com; > > shakeel.butt@linux.dev; ryan.roberts@arm.com; Huang, Ying > > ; 21cnbao@gmail.com; akpm@linux-foundation.org; > > willy@infradead.org; Zou, Nanhai ; Feghali, Wajdi= K > > ; Gopal, Vinodh > > Subject: Re: [PATCH v10 6/7] mm: zswap: Support large folios in > > zswap_store(). > > > > On Mon, Sep 30, 2024 at 10:32:21PM -0700, Kanchana P Sridhar wrote: > > > zswap_store() will store large folios by compressing them page by pag= e. > > > > > > This patch provides a sequential implementation of storing a large fo= lio > > > in zswap_store() by iterating through each page in the folio to compr= ess > > > and store it in the zswap zpool. > > > > > > zswap_store() calls the newly added zswap_store_page() function for e= ach > > > page in the folio. zswap_store_page() handles compressing and storing= each > > > page. > > > > > > We check the global and per-cgroup limits once at the beginning of > > > zswap_store(), and only check that the limit is not reached yet. This= is > > > racy and inaccurate, but it should be sufficient for now. We also obt= ain > > > initial references to the relevant objcg and pool to guarantee that > > > subsequent references can be acquired by zswap_store_page(). A new > > function > > > zswap_pool_get() is added to facilitate this. > > > > > > If these one-time checks pass, we compress the pages of the folio, wh= ile > > > maintaining a running count of compressed bytes for all the folio's p= ages. > > > If all pages are successfully compressed and stored, we do the cgroup > > > zswap charging with the total compressed bytes, and batch update the > > > zswap_stored_pages atomic/zswpout event stats with folio_nr_pages() > > once, > > > before returning from zswap_store(). > > > > > > If an error is encountered during the store of any page in the folio, > > > all pages in that folio currently stored in zswap will be invalidated= . > > > Thus, a folio is either entirely stored in zswap, or entirely not sto= red > > > in zswap. > > > > > > The most important value provided by this patch is it enables swappin= g out > > > large folios to zswap without splitting them. Furthermore, it batches= some > > > operations while doing so (cgroup charging, stats updates). > > > > > > This patch also forms the basis for building compress batching of pag= es in > > > a large folio in zswap_store() by compressing up to say, 8 pages of t= he > > > folio in parallel in hardware using the Intel In-Memory Analytics > > > Accelerator (Intel IAA). > > > > > > 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.roberts@arm.com/T/#u > > > > > > Co-developed-by: Ryan Roberts > > > > I would change that to > > > > Originally-by: Ryan Roberts > > > > > Signed-off-by: > > > > and drop this for now. > > Thanks Johannes. Sure, this sounds good. Should I post a v11 for just thi= s > specific patch which this change, or a v11 for the entire series? Andrew could probably make the change for you while applying the patches to mm-unstable if you ask nicely :) Also since we agreed further cleanup can be done as a followup: Acked-by: Yosry Ahmed