From patchwork Fri Nov 18 07:30:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 22158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp45999wrr; Thu, 17 Nov 2022 23:32:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf4aedfZfjofp4DgnUDbIrtVnllJHp6K3uyIDiBlpyGppFhj/YXa3xRTj8LbG1OUW2P+BhRY X-Received: by 2002:a63:f5a:0:b0:43c:428d:1701 with SMTP id 26-20020a630f5a000000b0043c428d1701mr5444200pgp.307.1668756746555; Thu, 17 Nov 2022 23:32:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668756746; cv=none; d=google.com; s=arc-20160816; b=bnQz8ctrdw2YVg4eYiFRwtgZROjJ85IMweWIR3nwshd6pXdu5VuRaogHRvr3aJGpN2 +uDxDw1sgPg5AIJMbEMLUDfQOdV2Kj/uFRAiOb/mPlHEIyNjbG9VNzy01C7m7kv6BNk7 h7bOJZUhmedG95jSh6aqOYvRBKxqy+47iqlibCSsQ0hlcH8sokGkuG47bhX1MJDwYAoE BIxaV3hwXfIIcFDzrK6IO8cPSom9lqGwFZHZ2tL+eRxTB0gZ8YrsE/JyJsy6lsbR1rOR Skn2hZydgrwC2aRd/aiXpGDnI3n5p9xdhgcK2R5z+J6YdiAiRM07jyRjPwOwfNZFqQAw E53Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3YDT/XAgh5QSXlyod86SZaadrvntYw6ff/cmVDaxdzo=; b=DPnR1nsTcfJHgxRihVaqlyx514FcGR7AV8iQKNgqs8kTBmVREb0aDgF5GJ/2XcZwv5 wRDx7Pl3lgnDgcdJnt4xYXoa3VrBjxVJgz3VlhcD/xUCLGmO5eB9P63pauBnqLiylvO9 hEzSg7dJ/DCR7UaqJzkWWx7zHC6BRRWxshjxkoauyxEn1sPG9p1PGnqeG/DvMfxNBIa6 QxbSYJ27Q3ftxCTAkpNcepcfR7tEF50LfkHzCg1ZTvr7zIGoO+HU/mpOvmdwfG1Qwpwt SEGmwr2fZ5Vy4JBlakLUaOIy+9E6K8PPRJG94Y8HotMjNK14mmOkk14Mc6d2MDoMJAUU oxTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="hj4sZ/oW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w2-20020a170902e88200b0017f77922b11si3415865plg.84.2022.11.17.23.32.12; Thu, 17 Nov 2022 23:32:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="hj4sZ/oW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240852AbiKRHbS (ORCPT + 99 others); Fri, 18 Nov 2022 02:31:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241180AbiKRHbC (ORCPT ); Fri, 18 Nov 2022 02:31:02 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28F4E7EBCD; Thu, 17 Nov 2022 23:31:02 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id g62so4111161pfb.10; Thu, 17 Nov 2022 23:31:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=3YDT/XAgh5QSXlyod86SZaadrvntYw6ff/cmVDaxdzo=; b=hj4sZ/oWS0i8ScGh0vbYAIusnjEYl4+v/V1w1lie+penPK+3QNfEw3e9lA2YvJY2vR 6U/s2favaWtrdVTN7ZxQYN3TNv3Gzmpp604WxQwf07cMv2V49N2eaV7INf9Mr/Fka3YI xDOXnWXwgetOrVE/PlHzDoVG1SMMD4hoFkHh/oQNMdcDaEpRuTgXjAO9bddr37OTQA9S ktOJf5nHzqLSna/GQtVnkHo4D6L/QgA1XlGFW6vtKLEvNOd3QZJfPnrf0ZJ6H9hrmP42 2o4Oyky8msMLDuOQ8ogXe9MjRO0eSJ3lurHDvLvpnWxaXJlo2L20CeupZWrVkRx6b2tf oYKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=3YDT/XAgh5QSXlyod86SZaadrvntYw6ff/cmVDaxdzo=; b=NSkxy0zpHpj8XCqSBDQ8eSGvSCt8q1QUxAqk3Yo4TYPe7C2lp4QoeiHf0CgmWbhJ1K 3MamBtCrYV7LKZJud0GXw2OPqewHhLhSu78kOUXTI11zo6da6nbsV7ZD09pEE92O+tjN ifcbGWaNXP+ubbSJGeJOoTc70j/G3d6187Osx1E0H0idrjVEcupbRbUzZl8R1dtatdhF 0puz2olOmbbWtLwxjd8DnuHDhiiS1wx2yr3ycoCdWk/XJbwag29ya+KyydseotnSl9Jq MNS24gwhyHxS5fjQZg88HoxsOZF+tF0p174uA2HJOwbaru4k5FEPNacY5wx0RE704V/9 E2Aw== X-Gm-Message-State: ANoB5pnsIkBO0aJ3IWESFTGgZz32mST/X7Kb5oYTMiyJjAKOs3kaRUtN 9OBDDQeYM1Kqh9UEiDEsuAANe32IzzBCyw== X-Received: by 2002:a63:1c66:0:b0:476:c782:e5d1 with SMTP id c38-20020a631c66000000b00476c782e5d1mr5496113pgm.261.1668756661587; Thu, 17 Nov 2022 23:31:01 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::2c6b]) by smtp.googlemail.com with ESMTPSA id f7-20020a625107000000b0056b818142a2sm2424325pfb.109.2022.11.17.23.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 23:31:01 -0800 (PST) From: "Vishal Moola (Oracle)" To: linux-mm@kvack.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org, akpm@linux-foundation.org, willy@infradead.org, naoya.horiguchi@nec.com, tytso@mit.edu, "Vishal Moola (Oracle)" Subject: [PATCH v3 2/4] khugepage: Replace try_to_release_page() with filemap_release_folio() Date: Thu, 17 Nov 2022 23:30:53 -0800 Message-Id: <20221118073055.55694-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118073055.55694-1-vishal.moola@gmail.com> References: <20221118073055.55694-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749818274381713137?= X-GMAIL-MSGID: =?utf-8?q?1749818274381713137?= Replaces some calls with their folio equivalents. This change removes 4 calls to compound_head() and is in preparation for the removal of the try_to_release_page() wrapper. Signed-off-by: Vishal Moola (Oracle) --- mm/khugepaged.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 4734315f7940..3f21c010d2bd 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1747,6 +1747,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, xas_set(&xas, start); for (index = start; index < end; index++) { struct page *page = xas_next(&xas); + struct folio *folio; VM_BUG_ON(index != xas.xa_index); if (is_shmem) { @@ -1773,8 +1774,6 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, } if (xa_is_value(page) || !PageUptodate(page)) { - struct folio *folio; - xas_unlock_irq(&xas); /* swap in or instantiate fallocated page */ if (shmem_get_folio(mapping->host, index, @@ -1862,13 +1861,15 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, goto out_unlock; } - if (page_mapping(page) != mapping) { + folio = page_folio(page); + + if (folio_mapping(folio) != mapping) { result = SCAN_TRUNCATED; goto out_unlock; } - if (!is_shmem && (PageDirty(page) || - PageWriteback(page))) { + if (!is_shmem && (folio_test_dirty(folio) || + folio_test_writeback(folio))) { /* * khugepaged only works on read-only fd, so this * page is dirty because it hasn't been flushed @@ -1878,20 +1879,20 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, goto out_unlock; } - if (isolate_lru_page(page)) { + if (folio_isolate_lru(folio)) { result = SCAN_DEL_PAGE_LRU; goto out_unlock; } - if (page_has_private(page) && - !try_to_release_page(page, GFP_KERNEL)) { + if (folio_has_private(folio) && + !filemap_release_folio(folio, GFP_KERNEL)) { result = SCAN_PAGE_HAS_PRIVATE; - putback_lru_page(page); + folio_putback_lru(folio); goto out_unlock; } - if (page_mapped(page)) - try_to_unmap(page_folio(page), + if (folio_mapped(folio)) + try_to_unmap(folio, TTU_IGNORE_MLOCK | TTU_BATCH_FLUSH); xas_lock_irq(&xas);