Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp768303lqj; Sun, 2 Jun 2024 23:04:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW7LpqwqhMqzQ5Qc2fXBcdPRdD18Et55UDCcjJ5vlfMVUdMIjC1jbqFPgk8XMqPazMKholcJEZAFyY4w5FIlVznBS4qLspcAw94NbbEmQ== X-Google-Smtp-Source: AGHT+IFIoRchhOIMhyix6xSJpHdVDYuAbOy8gwiATdIvepw16GgE17w59OpCuem8CbRAeqvJyvIJ X-Received: by 2002:a05:6830:a4a:b0:6ef:8860:b329 with SMTP id 46e09a7af769-6f911fba15fmr10211321a34.25.1717394668914; Sun, 02 Jun 2024 23:04:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717394668; cv=pass; d=google.com; s=arc-20160816; b=qEuGNFWPA/kboHNVpr9E9UWQ4GH/FW7X+/ouvrFvhZEJe4JKM6EcunmDVufH/2TLHu 1TowazZcDUWlC6Ep1UFB9HVyVETMvEZq4rdXPxkhwZqfQSyn5tV8ZLx9ctQyrMo8Koo9 VglsZR12C0gCILsz0E/EA+9XRuKkQtLP5V4YFjzfhqnKshx81gvPZdYiIUpxyVgcJtUm rER3iO4T0VsphLbfoAIKnyWD6szn9wDH+TlI4xOjzkeBur6l+EICT3iSBaz6RycMKg4d 5JC+iXUv9u/SjJGh70MAa/Xj14Q0ZfgOIW6/O83F+T23gSaxOEhU0f6OF3Jwx2ZCk53j 9tMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=VAJn/Jtb/IU6mglsNtTOn+b7ZlaaeT7CsuHSdA2/NbQ=; fh=Yjq1BpTGtQAJ1zk6ixWSiQU5aDIAiYaQEu9NPGz15/8=; b=OnHcloH+Tx7fRuHM+em9GPPr4wEYt7Lrg5zw45YOVyu/DJ6zPaG9qHLC2bOJ3ui5Wf qyD8mAkNmZYCO383iMFk2yWw6udMbA1kvtPq358s2buvl3rHqxy0fIlzqRjRAXR98dLo fvYaT0Lmfeeg64L3TF5xMHICMvnUwHqeFqzG4GNWEgTIXfMDYNZVy1USf5Gxf2hM6bSk qmSFIANjv9U4i98r+7LF5IPeyfbncf5KmCmugQROv4jxgceU55OouhfGXXLBS8zGPhWR D3RsKuNV36+AJ3QAGPXO8Jr70bA0uwi9tsKQQhschO8FoH/iaqXbis/xnV3wiBKSovkz ZP7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="Th/GCHfE"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-198622-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35c73bde0si5840882a12.754.2024.06.02.23.04.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 23:04:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198622-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="Th/GCHfE"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-198622-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7B515282259 for ; Mon, 3 Jun 2024 06:04:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B576323765; Mon, 3 Jun 2024 06:04:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Th/GCHfE" Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F2B9182DA for ; Mon, 3 Jun 2024 06:04:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717394662; cv=none; b=u/9oJbp3H7QBGuTvJA2PsRkpUNELEC29JkGE3GqBMjo2+51lQbz4HpxtYZtz7HEo7a/fVo2yDpg4vUlH9LDotKbqHlkfNu4e0aukqU64o8e6N4yzzVF/V1Br8GtZ+4TQpIyyByK5GJuiWHC+hiH6reSrfiqJOxLjuv8fqo8+Kow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717394662; c=relaxed/simple; bh=5QU6n6Fc8sM+CG4UdsGinL5uZmInSgrN4O1VOuovo7A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=LznykUSJSMVMRwCDN2J7a8zWAK8L/M1pySdvC3+p4OpYSgZB1r/4oL9weCHKNsYB6DkjTnCEObwJBqEDd5O2rm2wrfyv2IvyzQ0fAppTlnKa8Uz7j2pR7vegxuZSw99vi5JjBiIdJRGn5DI16tiFXQKcmcotYtOXY2MH+rRM9Dg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Th/GCHfE; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: yosryahmed@google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717394657; h=from:from: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; bh=VAJn/Jtb/IU6mglsNtTOn+b7ZlaaeT7CsuHSdA2/NbQ=; b=Th/GCHfEXrsGLfvyxPZwtXH5pDG5jI+gNqOkuAgi6WgEbWaGMKlZyzo+WHqBx3Xgi/VY73 6ae0Lb/yIW8ZJLAbyS6nqHdk/mgoCKcjs3wu5itDWaa289CPPNKl/DHkinouemD+8wYbpO 5EphkgFc30BOvgnr5Dlo5TgUP3HfTTw= X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: hannes@cmpxchg.org X-Envelope-To: nphamcs@gmail.com X-Envelope-To: willy@infradead.org X-Envelope-To: linux-mm@kvack.org X-Envelope-To: linux-kernel@vger.kernel.org Message-ID: <4daef95a-4cb0-4292-9775-a0fe9993205f@linux.dev> Date: Mon, 3 Jun 2024 14:03:45 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 1/3] mm: zswap: use sg_set_folio() in zswap_{compress/decompress}() To: Yosry Ahmed , Andrew Morton Cc: Johannes Weiner , Nhat Pham , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240524033819.1953587-1-yosryahmed@google.com> <20240524033819.1953587-2-yosryahmed@google.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <20240524033819.1953587-2-yosryahmed@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2024/5/24 11:38, Yosry Ahmed wrote: > sg_set_folio() is equivalent to sg_set_page() for order-0 folios, which > are the only ones supported by zswap. Now zswap_decompress() can take in > a folio directly. > > Signed-off-by: Yosry Ahmed LGTM, thanks! Reviewed-by: Chengming Zhou > --- > mm/zswap.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/mm/zswap.c b/mm/zswap.c > index a50e2986cd2fa..3693df96c81fe 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -917,7 +917,7 @@ static bool zswap_compress(struct folio *folio, struct zswap_entry *entry) > > dst = acomp_ctx->buffer; > sg_init_table(&input, 1); > - sg_set_page(&input, &folio->page, PAGE_SIZE, 0); > + sg_set_folio(&input, folio, PAGE_SIZE, 0); > > /* > * We need PAGE_SIZE * 2 here since there maybe over-compression case, > @@ -971,7 +971,7 @@ static bool zswap_compress(struct folio *folio, struct zswap_entry *entry) > return comp_ret == 0 && alloc_ret == 0; > } > > -static void zswap_decompress(struct zswap_entry *entry, struct page *page) > +static void zswap_decompress(struct zswap_entry *entry, struct folio *folio) > { > struct zpool *zpool = zswap_find_zpool(entry); > struct scatterlist input, output; > @@ -1000,7 +1000,7 @@ static void zswap_decompress(struct zswap_entry *entry, struct page *page) > > sg_init_one(&input, src, entry->length); > sg_init_table(&output, 1); > - sg_set_page(&output, page, PAGE_SIZE, 0); > + sg_set_folio(&output, folio, 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); > @@ -1073,7 +1073,7 @@ static int zswap_writeback_entry(struct zswap_entry *entry, > return -ENOMEM; > } > > - zswap_decompress(entry, &folio->page); > + zswap_decompress(entry, folio); > > count_vm_event(ZSWPWB); > if (entry->objcg) > @@ -1580,7 +1580,7 @@ bool zswap_load(struct folio *folio) > return false; > > if (entry->length) > - zswap_decompress(entry, page); > + zswap_decompress(entry, folio); > else { > dst = kmap_local_page(page); > zswap_fill_page(dst, entry->value);