From patchwork Fri Oct 18 10:48:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 13841574 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 0C9AFD2FFEC for ; Fri, 18 Oct 2024 10:50:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82FDD6B008C; Fri, 18 Oct 2024 06:50:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E12A6B0092; Fri, 18 Oct 2024 06:50:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A7416B0093; Fri, 18 Oct 2024 06:50:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4EDA46B008C for ; Fri, 18 Oct 2024 06:50:44 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2F8A8A18AF for ; Fri, 18 Oct 2024 10:50:22 +0000 (UTC) X-FDA: 82686404472.10.8074FBF Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) by imf30.hostedemail.com (Postfix) with ESMTP id 8FE908000A for ; Fri, 18 Oct 2024 10:50:21 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=b6XNjzLC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.222.171 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729248534; a=rsa-sha256; cv=none; b=jUsInVmpiVZQhTu3oUtDw1qAGeVZfNM3geN2pQyua4hGCd9Hro3vGE5UfnI8M7P021vVHb U70yt9bV7fGPnnBuXbyX72Y/11I0UKyp18+v/QpJRZGZEADbZ6syuZ5q+vBKVEIwS070HW e+lMT1/4QXk6jgVwGCGRA8XM1DM4CRc= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=b6XNjzLC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.222.171 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729248534; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=I0lh5Dj84nRQ80twxUOjXO55WZ5GvafoDcM5bsLvOt8=; b=Y1/Oa7Ag6biC/Yyj47NJ0Ed9w1PR6jRpynmfhobL+napW/zW9x8khjWfmeC6EIudg5+qk/ HIoKXzk0QV1QsCchCEnlDsfqdjcMbf5Qxv97jD7id/XRShZWHrsSYiWEAVUUqtRBDrETcI rwzCp8EyxTmYaW9ApigST3lgj9FtJz0= Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-7b14077ec5aso262723885a.1 for ; Fri, 18 Oct 2024 03:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729248641; x=1729853441; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I0lh5Dj84nRQ80twxUOjXO55WZ5GvafoDcM5bsLvOt8=; b=b6XNjzLC09IHpYZYIIoQ3T8lAVcoMRmor9rzEufITjvlqd45o+axw0TnjxXd/nTzZb o1sfdhE5Cjca4f0HygpjtKS7lfh710mUcHrcLQva4tSV5Q8u3FUxWTM5gsfL0jxRnKsz DnXjuJM+s3T703gR6s6BzuoYwWfaNveCOmpW0Io1M+obVpwBg7n/GQXXr+iFXZrJEGJN qLmqRyVTUqjFCgs43Ycub8fWyNme3t537qs3V7HSBOmL0RMATzI0SjWFAmEmqlXWFrmz 8JDXPcVMfqM1aZFqPbD+becWSXlFfGU85SPen/xZrp79rOMaJZGIMoTDQKVNCyvqs6yv 0omw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729248641; x=1729853441; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I0lh5Dj84nRQ80twxUOjXO55WZ5GvafoDcM5bsLvOt8=; b=O1pn95y7yNC2XzKHs0ZOOrLeZNouE5uNQL6vNQ5cMGR4hqAd761gXrNK9gifQAuL31 lkRoHcfSLQ2NwfMEeWcn4BnzHKWhyKe8MMj1ljHgSr85a8vu3cTWyKkAobqwicJyT5qh y7x/ciH/a/mFRBH0AWkxzxxJS8CehMteDGhZDuoFqx5feZSl4KO6h1P688NFZSWQZx27 jAB2vVlN9L+WVpJW+I98bnOTgjUrSy6z6HqKrnLsPx3BYOPiO+r1V2dct2mgU9+ispzZ Lw9hP4X7sLEaKNqd++bUQsy/GIbrPgrWsfYeWfPPSt1gze9i+1K/gkPxOZ/QM66Zjhck tn7A== X-Forwarded-Encrypted: i=1; AJvYcCVT7hurGcZVCYNM3zPED2lDAlllEis4vc3fiKGoJD7U6bg1vjilPULlanmzGjYWyhbtQrSXe6VY2A==@kvack.org X-Gm-Message-State: AOJu0Yy1FflbZVRPaCQ2mA3gSwHPlSMNIGm8RNCW3LxST+iQ/r7plSFV ayOL3nJenbptYKx8UIwXpdrbNRCrxsd5Ke/dhybWXYWlrhMTREVF X-Google-Smtp-Source: AGHT+IES+vksoooguMP9yHq2t67dioxSjxiMZLvUVEe1xr8iSRA7X5ppyMkALt+mUyKvRjjB7jAf4A== X-Received: by 2002:ac8:5e0f:0:b0:460:38f5:8753 with SMTP id d75a77b69052e-460af182969mr26970431cf.26.1729248641313; Fri, 18 Oct 2024 03:50:41 -0700 (PDT) Received: from localhost (fwdproxy-ash-018.fbsv.net. [2a03:2880:20ff:12::face:b00c]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-460ae96d3ccsm6189371cf.32.2024.10.18.03.50.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 03:50:40 -0700 (PDT) From: Usama Arif To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: hannes@cmpxchg.org, david@redhat.com, willy@infradead.org, kanchana.p.sridhar@intel.com, yosryahmed@google.com, nphamcs@gmail.com, chengming.zhou@linux.dev, ryan.roberts@arm.com, ying.huang@intel.com, 21cnbao@gmail.com, riel@surriel.com, shakeel.butt@linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Usama Arif Subject: [RFC 2/4] mm/zswap: modify zswap_decompress to accept page instead of folio Date: Fri, 18 Oct 2024 11:48:40 +0100 Message-ID: <20241018105026.2521366-3-usamaarif642@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241018105026.2521366-1-usamaarif642@gmail.com> References: <20241018105026.2521366-1-usamaarif642@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 8FE908000A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ybffj51thopsw45rac1r8wnqyghbyyzu X-HE-Tag: 1729248621-52934 X-HE-Meta: U2FsdGVkX1914HaosCU8jvKub7kaHA0AInneW78flKmn4hd2wCwTWv5JHS8s4+L7Cy4EorKfckJXttmryQyBY8cfuGKc0YZBkRQN8qsCV8x4vx22/DIMmmQyTTh7aodFmyOBPP9Xng9hT/WOJQSBv0vY7ud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Lxe1SGLAcHhiz+igVk2yY2UMiPVjmbLAvOFloR7vn1VWSdqQ7oRVqbEumGvc1Uvt6jzeniWliPb6QvUGR0kPE1JcQTJDdRcM0Gw+1ELRaVQTopmoiA70zucF29DkRj+Yq+OJ5CbZEVpoxHgodixd/8u7SQSaMnrMmHk3DKG6z+tI2zfgae4prOzg95m0CImVtjogl20MQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.003328, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is a prerequisite for zswap_load to be able to decompress large folios. zswap_load will iterate through each page in a folio and decompress into it. Signed-off-by: Usama Arif --- mm/zswap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index f4b03071b2fb..9cc91ae31116 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -953,7 +953,7 @@ static bool zswap_compress(struct page *page, struct zswap_entry *entry, return comp_ret == 0 && alloc_ret == 0; } -static void zswap_decompress(struct zswap_entry *entry, struct folio *folio) +static void zswap_decompress(struct zswap_entry *entry, struct page *page) { struct zpool *zpool = entry->pool->zpool; struct scatterlist input, output; @@ -982,7 +982,7 @@ static void zswap_decompress(struct zswap_entry *entry, struct folio *folio) sg_init_one(&input, src, entry->length); sg_init_table(&output, 1); - sg_set_folio(&output, folio, PAGE_SIZE, 0); + sg_set_page(&output, page, PAGE_SIZE, 0); acomp_request_set_params(acomp_ctx->req, &input, &output, entry->length, PAGE_SIZE); BUG_ON(crypto_wait_req(crypto_acomp_decompress(acomp_ctx->req), &acomp_ctx->wait)); BUG_ON(acomp_ctx->req->dlen != PAGE_SIZE); @@ -1055,7 +1055,7 @@ static int zswap_writeback_entry(struct zswap_entry *entry, return -ENOMEM; } - zswap_decompress(entry, folio); + zswap_decompress(entry, &folio->page); count_vm_event(ZSWPWB); if (entry->objcg) @@ -1666,7 +1666,7 @@ bool zswap_load(struct folio *folio) if (!entry) return false; - zswap_decompress(entry, folio); + zswap_decompress(entry, &folio->page); count_vm_event(ZSWPIN); if (entry->objcg)