From patchwork Tue Jul 23 15:35:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13740179 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 27567C3DA49 for ; Tue, 23 Jul 2024 15:35:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F14CE6B00BF; Tue, 23 Jul 2024 11:35:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC5D96B00C0; Tue, 23 Jul 2024 11:35:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF24D6B00C1; Tue, 23 Jul 2024 11:35:27 -0400 (EDT) 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 AC5956B00BF for ; Tue, 23 Jul 2024 11:35:27 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6D91DA0164 for ; Tue, 23 Jul 2024 15:35:27 +0000 (UTC) X-FDA: 82371416694.24.A2A2318 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf14.hostedemail.com (Postfix) with ESMTP id 92BBA100025 for ; Tue, 23 Jul 2024 15:35:25 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="UUZ6K/3x"; spf=none (imf14.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721748903; 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=/dA6HBMc6uKpbYOiJasf7cbWJ1qRymTAoZ2gMBqvEQQ=; b=do+lll63FEzFx7fNbATgMwWmy3P0R8tldUeNle16QThOkedAy7NJjiJf3E30wf4IbPQIDE XHAxmi94WeSV8roszmsZQEYD8dbVKyhTFN2OOMWcBjmecTkCGMqw1rib67BAJ+yMjymOwt azeoifXdiOdE/1f/ND9J1RhiF2gbBuo= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="UUZ6K/3x"; spf=none (imf14.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721748903; a=rsa-sha256; cv=none; b=RPAO1TIsHP6K/U8qp1R391359nvL03UI0vMnn5JWIAnMdHZZ5zwDEnPoL5kue4SHgEYvBe ufH2On7zL0tnVqbItbvx8BbAb7EUu1jS6ldTV4q/Quf8aY0dlWW5u8eX27cOofUDJ5GIsJ uCIMDu5JDQ9MkEg60MC2iYl1x8fhtjo= 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=/dA6HBMc6uKpbYOiJasf7cbWJ1qRymTAoZ2gMBqvEQQ=; b=UUZ6K/3xbZjY927kWQHTOhG+uE 9wYYkZC+hh/VFctrNYTsAYYiJeexcLG54/ylABtFGpU/6tcP+3n3xpgAM3BF2NrEITI+15k2eavFI eUYhELzgv2YsThLlH2tDyOp8VBY9ZQGHxdXa0cxD7jbHA2vV/C995MAVJF3AJF52gzTjViU5iM1y3 fNivCS0UKugZyzsX2TspByz7L+M1lPmWedEYmlIKhE6ADIdxn43BTskxhozE5RjR4ZhlTpkKaVj22 o4wHwbY8oBYyvEyF9EkKQ+PanCF0eyTuG0eR1KVu0adYOsC0tnkqD2+BdSKO4UY99F/W2H8HGfqEN nkmmuo2A==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWHXd-000000070LO-1dRo; Tue, 23 Jul 2024 15:35:05 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 5/6] mm: Remove references to page->index in huge_memory.c Date: Tue, 23 Jul 2024 16:35:00 +0100 Message-ID: <20240723153503.1669586-6-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240723153503.1669586-1-willy@infradead.org> References: <20240723153503.1669586-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 92BBA100025 X-Stat-Signature: oug4bp5h6bm9uy5agymwjq6myzoedshc X-HE-Tag: 1721748925-734416 X-HE-Meta: U2FsdGVkX18Ze2V+pV9HnvrKNOKvcfZX/pfggTTJoVe2Mbmv7t9QpscOjkC7/wg0KapEDImwoBAxD6tqg4+ztOn0W4s9UJe9OS/19Vs1fcRBs9vOYcqNgLcBaR/c15KJcialVchq3EZGMGbHXkOXFhaWSlocugIqcRwZ7G8ob5qMJkade9caONWt508ZmBYzbB637jocyGaNBvKXl8FBuiOHfWvXjSquBVsLkTsMLovboTK132fmOZLSZmGtDCBKMyVm3CoWYOCM5eUM7smY/V0unmk4Awd/STX8IlxiqPQWmC3C7S8aSkekP6qreQCc6pk/iLj2wOHYl6tgzf8QNL/pfyXmhnDuVkfq1Ba3RYvSckWbhvg1ZoD3P0nY4tz7uPP5+Kb3soOPZ20XudXmRD6OMYGZ0nj1b4dneDVUOjsBpSAUoFJnjtY/EMf/pI2LGfz2vaLw+fzDSd/ZDYSWThvaIhV03NYIibDAA/qDvQhZy2ch+Rxa4S6KtfaT362U0NcVAISrtWFL6OMQI5F6OFtBHknDJ85osX3vgbIkKm9dxw9jsjZVq2IIUR8qj1DMFkQuTo9Znzent4P+ng40f9r6KylSC93VWLqa/vGbUPZygCy4bsetyAv9PhCQ95zKWO2xUJIwuit2ySSpKBhix6zuv85SUuWqLmW1E21oiyugvDoHMiCLASsDHbBzo2CgHzMvV99tppJX2keIWQPjP11Mz4lPf2MdpFSgCwOMAhbNFGlclGoM38HqSoVV9MMW5GmRkvAs4zUbX2twB58V9GZtKQi5+/yIUvPMZYMKOVfKRHJwWsQIOsNPiBvfLOSjntnw+1LphbjtHeZaQrl/0OiYuTzl9L/0qWV023UjMmHEB3u3GStQcx3wGcYtVU8G3oxRcNYyABfrZ9DosQKdDGNHSyvCIVooGNNTtK6AWbCMaAOrJ89MULzj6FpSfksSBwQPKV2lO9hrbd3QPhp RLu+I+cq JL9hZix4BY912fu2L3LCeX59A2lYtmvDMuwmKq6ZU7FVO4WlfVkFiUmhTt2h+1ISAyqFYc0wJTLTXxHDjYZThMe+D0UVD9+87lqCBhodAEN9GirLViJmOE/AMM3k5vRFR45MnfZmRveWjUgjv+CIuFU9xZtFF8NieYcdJNmvRvbOGLI0aJJdPR2Or37u3QqBEHdGTohoPf2ffMTgHcnA8n2h7z+vetKupCoL8IgY4AwtQXOlKJvKYEvGKptYm6fWmdiP7uaVa7920wo4= 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: We already have folios in all these places; it's just a matter of using them instead of the pages. Signed-off-by: Matthew Wilcox (Oracle) --- mm/huge_memory.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index f9696c94e211..4ffcae1c82e1 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2860,8 +2860,8 @@ static void __split_huge_page_tail(struct folio *folio, int tail, /* ->mapping in first and second tail page is replaced by other uses */ VM_BUG_ON_PAGE(tail > 2 && page_tail->mapping != TAIL_MAPPING, page_tail); - page_tail->mapping = head->mapping; - page_tail->index = head->index + tail; + new_folio->mapping = folio->mapping; + new_folio->index = folio->index + tail; /* * page->private should not be set in tail pages. Fix up and warn once @@ -2937,11 +2937,11 @@ static void __split_huge_page(struct page *page, struct list_head *list, ClearPageHasHWPoisoned(head); for (i = nr - new_nr; i >= new_nr; i -= new_nr) { + struct folio *tail; __split_huge_page_tail(folio, i, lruvec, list, new_order); + tail = page_folio(head + i); /* Some pages can be beyond EOF: drop them from page cache */ - if (head[i].index >= end) { - struct folio *tail = page_folio(head + i); - + if (tail->index >= end) { if (shmem_mapping(folio->mapping)) nr_dropped++; else if (folio_test_clear_dirty(tail)) @@ -2949,12 +2949,12 @@ static void __split_huge_page(struct page *page, struct list_head *list, inode_to_wb(folio->mapping->host)); __filemap_remove_folio(tail, NULL); folio_put(tail); - } else if (!PageAnon(page)) { - __xa_store(&folio->mapping->i_pages, head[i].index, - head + i, 0); + } else if (!folio_test_anon(folio)) { + __xa_store(&folio->mapping->i_pages, tail->index, + tail, 0); } else if (swap_cache) { __xa_store(&swap_cache->i_pages, offset + i, - head + i, 0); + tail, 0); } }