From patchwork Wed Dec 13 21:58:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491932 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 3C1AEC4332F for ; Wed, 13 Dec 2023 21:59:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 109158D0066; Wed, 13 Dec 2023 16:59:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B8E18D0062; Wed, 13 Dec 2023 16:59:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E745F8D0066; Wed, 13 Dec 2023 16:59:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D28498D0062 for ; Wed, 13 Dec 2023 16:59:12 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B2B24A1C15 for ; Wed, 13 Dec 2023 21:59:12 +0000 (UTC) X-FDA: 81563161344.10.842B3C1 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf24.hostedemail.com (Postfix) with ESMTP id EB156180014 for ; Wed, 13 Dec 2023 21:59:09 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ut40WeIl; dmarc=none; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504750; 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=LiLAAWMznx0lrGKk7Hps+YMdG+IWFpi8TmV7QhW0H2Y=; b=36dYRA4YDGRT+ieIs3XbgdVXWCzD2tDNvEJXr3u9eL3m+P/Vebpt638rdqJWrH9WTbuAq9 S1bZXB1jrc93NQtT9YmGToaRThuwPUHoys+stm51XloFGG1V8XLoi4C8GRmu7m1Pr8XYmb aM501jfHMejYXQTm4pQUrogyQ3nyX70= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ut40WeIl; dmarc=none; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504750; a=rsa-sha256; cv=none; b=Ht3t/Ui1R9ILutKDs5h6/WjPWbxMBjT6YnrzWos6a+wi9Q4SrZ1eCQa2davNScrlY/DpJM ups9RkCAJqMSM0sqz6C1s33CnmMGLoyUDoN36ZOtKoE63fsknK2OPwk9KGo3Lj0z9NgZ+m D7a9XQoIhFb1X5HizLxcAcptb4gvCb8= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=LiLAAWMznx0lrGKk7Hps+YMdG+IWFpi8TmV7QhW0H2Y=; b=ut40WeIlSsZrekaM7GYfsx1NXh 142DOVw7yhzJVQWz9WZrYaqkGZpYwIa8QEAAglCEDN0JJyMVhrhyVv4scWjQ9n+tfzgoN5HpBpN+U YxNBRZOpS7BoXUxxOcyHr+MSyNFaeR31Yxa8dH2NzI4Jetg+keCIHsug7aKw7XqF1AqcJDu2aevZL Pthna/ROvnvXcrW4IJCXA5SrfAuLMltpoSlMA5fUqEoUBIgX9LgVBL4psQk63oh1mw2YQin3YD5vv f22m2HBUCUybJMvuXU54XbNEt/RX9WizQckhc4yw5wd9GlGaY4UcWm1Y+k03qWuwchd1ySGQG7Xq0 3CnYXZhQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiN-Cg; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 03/13] mm: Pass a folio to swap_writepage_fs() Date: Wed, 13 Dec 2023 21:58:32 +0000 Message-Id: <20231213215842.671461-4-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 9zyiiccpse1s7xifugie16wht8cm7y9z X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: EB156180014 X-HE-Tag: 1702504749-81712 X-HE-Meta: U2FsdGVkX1+UWvZYji3T/Yvq7dqKxUetvyhiIgXPPVqik9m5ZMR2Ix14lFr1TW6m9L8QNXCYOmBeFEHT2h3QZ+QIS7YkRNjhPXcclyv86f3qEH5JVvRzhXHTW4zSt9qXBmvx+ZEEVf0ANd9G9Wx2QKd4wsHw3M3Z9NOO99qMlHlmBXbU6xFWq626/0DmnGT4UQpguDbSggnKjgTo2G9Sy1iNSlyxHzU+lC9iAIjXkzLI7+ZAbfYbE3ocDybi1Oj7HLLxbzom6CXVU4ZXUlwHx7JytwWpS1nciGia3RwbIF2HnFXOwoA0DB8QgA5g+g5PsiLcegdFqglclSfDUXqUxk1td4j1Jsx53d13OmYgolUmWU6StEipUR+zx5A/F4Qb9UvF9Z1fwGkiC/HV4pA7HPq2c4ez4XckCugN4n9ampHgOQW+nwBdN3APwHHEYWKNK8Dp5vIvy5C+7IW2fMENeuW2gkTSEAEw3TASXfX2gyiVwMGQ5vVNc7uic23Xn5WE6HG5i+KwUo4k155U9/GJgi/ufH/kUHVzbH2uIEXTTiRhztlJIDOzoU2QOQjizknIr7LddMTduEBwdVNE+ZiGqnUW8oaEt23M90V+miB94KmkMBljfyPCbg1zBiu0MbA/LdldgSmBHtBJFFXYWr5AsFRuL7NaXj/A/HmIcLHAJxM2Ae5GpLFnNdU6zqmtHXNRNp2e84ku8F2SDASMd1nJQDtq+kd0D4LFPlN+SOE818rHZdpPQqSFjmdYxOfVC4h1sRD47+7ZpIijCHDTFewN17XSqU5qyUy8LrX8kzq+U3H8vFqx+eG86MLI+9R2Ov2lFsn9rzAqmoO1B1GfaO0DRembPz8ayAiacCQ/96PkoP/rerK7cEXQBZXxR7EhBrW5lYgZUCKHT6i9SXn6HtBXfKovUyF1yeiShGR6vE8sQANgdnxWjY5mZ5uBkuju+H70mfXX8DsvPSaOqwz7iFA ZdvGDDul cGLt7vqD1FejpPugmv3u/eavNlKgRG41DA6OUWgbI/u+x01wkLQqvQkPh2LxGe+rDEFUgpUwJ8ISVhJlPcFfEyei3MSquGQcRV0ufmfRnXiUn3EUoC23eEuiNHU1i1rWBL3JvnLTNdhp+1oJ6xXroj5gYapVhddXAGKmDMk3EKEO9DABtC1k0hVWznRDXEABZnZKz1LEznbqQOE2fMxU4j2LVOP1hhA6Ps5uJ 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: List-Subscribe: List-Unsubscribe: Saves several calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index e0d59f36b70b..7f67d8e2ed9a 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -288,16 +288,16 @@ static void sio_write_complete(struct kiocb *iocb, long ret) mempool_free(sio, sio_pool); } -static void swap_writepage_fs(struct page *page, struct writeback_control *wbc) +static void swap_writepage_fs(struct folio *folio, struct writeback_control *wbc) { struct swap_iocb *sio = NULL; - struct swap_info_struct *sis = page_swap_info(page); + struct swap_info_struct *sis = swp_swap_info(folio->swap); struct file *swap_file = sis->swap_file; - loff_t pos = page_file_offset(page); + loff_t pos = folio_file_pos(folio); - count_swpout_vm_event(page_folio(page)); - set_page_writeback(page); - unlock_page(page); + count_swpout_vm_event(folio); + folio_start_writeback(folio); + folio_unlock(folio); if (wbc->swap_plug) sio = *wbc->swap_plug; if (sio) { @@ -315,8 +315,8 @@ static void swap_writepage_fs(struct page *page, struct writeback_control *wbc) sio->pages = 0; sio->len = 0; } - bvec_set_page(&sio->bvec[sio->pages], page, thp_size(page), 0); - sio->len += thp_size(page); + bvec_set_folio(&sio->bvec[sio->pages], folio, folio_size(folio), 0); + sio->len += folio_size(folio); sio->pages += 1; if (sio->pages == ARRAY_SIZE(sio->bvec) || !wbc->swap_plug) { swap_write_unplug(sio); @@ -379,7 +379,7 @@ void __swap_writepage(struct folio *folio, struct writeback_control *wbc) * is safe. */ if (data_race(sis->flags & SWP_FS_OPS)) - swap_writepage_fs(&folio->page, wbc); + swap_writepage_fs(folio, wbc); else if (sis->flags & SWP_SYNCHRONOUS_IO) swap_writepage_bdev_sync(&folio->page, wbc, sis); else