Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2886770rwb; Thu, 17 Nov 2022 18:17:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf76tXfbdPHwP8wjnLbTXPOZCiWDLroKbJcAeqEgZsYrhUC5+wQdxeWJtbIHWsYL5e13giat X-Received: by 2002:a17:902:c385:b0:171:5092:4d12 with SMTP id g5-20020a170902c38500b0017150924d12mr5516758plg.107.1668737827621; Thu, 17 Nov 2022 18:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668737827; cv=none; d=google.com; s=arc-20160816; b=ZnkRHEYrqzSMgZLwZlXQXwlls9x0+Hb434fbrPdZj3kGTf9u8qB9FgZhKxspnei5ec TrCH6SizBoPTqiIxfErFoGH/mZ9j/OJfajWyGLhkqbuVOOYXASFFRtMlM1F8MJj/tz+I 27wn8q/Pw2ViXuWeye0ZopfpLxup0Q6SDbbKrYznW3oR6JMYX2nahmjs9Y8buCCrDxgY KAKvciCZoz6NPoWrkbInNDlGqsmq/0B0I/TWVDI58Ido7htT0aBUrOPX18m06YIGSSiO t3z5zPM/KaKMO5FT1e4EFdsF3UM9XPN6uu6kMlC17M3187UtRDKgoPi3Imvlr5FsuniO jsmg== 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=VN9yd1A5EfueEGyrwxjenL17aRQ4nzLAVlpk7CXCRBFUxBogCbwfXQao9iM3v83q+6 XBZLkgUe5iTtDswBf1QLZQczzJMYrvGE8WHoD0Pnj3m2fN64mngBO4/Yo7qZ4cx1YpoG TeG4AzpCGl+r2+no99KR0FIKQSohQ0L3VM7Z/H2eO0UrDnC4fZpBOq0zwZeNbKs6uEom I7EkO4cayfwoNsveDTH28+tq7XJCUqVW5eTgsCAjmiaRQYsChIr6BVtzRjS6EuOBPOdZ SpTuE7oyN7Fsz2orjodPrVHZumuPwXdjDjpSyATHnv6AUhkVMjqD5MggnW84c1jOO1mS ACHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WIhEVv40; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nw5-20020a17090b254500b002180c61f557si2317051pjb.99.2022.11.17.18.16.54; Thu, 17 Nov 2022 18:17:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=WIhEVv40; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-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 S240875AbiKRCOY (ORCPT + 99 others); Thu, 17 Nov 2022 21:14:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240832AbiKRCOU (ORCPT ); Thu, 17 Nov 2022 21:14:20 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7257087575; Thu, 17 Nov 2022 18:14:19 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id b11so3286932pjp.2; Thu, 17 Nov 2022 18:14:19 -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=WIhEVv40bO8pPOe0T4T4maV1rYV4pai+d0aHe5h0r42FibWzau6xqjlbhDYj7fVP+/ YVbz1QBIEi5smOOlTRsnqvFnOSv1Un3EXZls7avo8RWt8GuSdf13vWB1vX+nyGT9q/EA T4uFXOL3nEQg/604IZpT78KAD+oBUy2DhDfpQmyGPPQ90V+476q3TDhM8JO5/eefRo39 Kc6oAfVStZxNFPpjkSEaVmtKQ/MwyY+KaTUq/ui8Z+wJ5NVT0RpHdPebMV2bUg0O0Yfb SscM0FktFuryyy6iQ7l4iU39d7doVgLL5n+BXTp0RKjfosJtcvVKIK7EIBdl3j/ynnVZ 8T3w== 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=KEiqHuji93hYmtLxhnOQ/w031eOtW+zGmvz7m1egWJ2Xw9j9diccgnBCrC6SQ558iM fuFAGq+31f+kj8zch1tSJFez7UuM6fvxNpyePsyiQXDURnKQk88vYRCLXDtQxPWEzDlU 75F5fHfJdR4Y3LYwOfNQrGk6eW0F6P2U533wyPdyXRwiMUSqykNMcf2PlIxcRFkkBy8U M0nRVCOXhZYA/FvVqtjyb91phLOCYI3mw3NS8B0TTk6/zVb0OgOgKYHG7fvTMfc7a+uc F5mxR6JzK1a6ZZ/oR3RDsCQxPdIB6HpRlICil+ZBSTNM9hzkqg+2eN7BybQ5KO+gKErt +KtQ== X-Gm-Message-State: ANoB5pn7Gn0dxJzr0FTgN4KBlqR2MQIp3Xd2MuSVYKLYeWZjm1eB1XMy 5MiKJp8GsKfatURN1vh6QxVGaIUj3KL7Dg== X-Received: by 2002:a17:90b:117:b0:212:f2be:bc38 with SMTP id p23-20020a17090b011700b00212f2bebc38mr11372286pjz.175.1668737658849; Thu, 17 Nov 2022 18:14:18 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::2c6b]) by smtp.googlemail.com with ESMTPSA id ip13-20020a17090b314d00b00212cf2fe8c3sm10678445pjb.1.2022.11.17.18.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 18:14:18 -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 v2 2/4] khugepage: Replace try_to_release_page() with filemap_release_folio() Date: Thu, 17 Nov 2022 18:14:08 -0800 Message-Id: <20221118021410.24420-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118021410.24420-1-vishal.moola@gmail.com> References: <20221118021410.24420-1-vishal.moola@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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-ext4@vger.kernel.org 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); -- 2.38.1