From patchwork Sat Feb 18 00:27:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Houghton X-Patchwork-Id: 13145392 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 63709C6379F for ; Sat, 18 Feb 2023 00:29:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B674280016; Fri, 17 Feb 2023 19:29:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 74044280002; Fri, 17 Feb 2023 19:29:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 56B29280016; Fri, 17 Feb 2023 19:29:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 44706280002 for ; Fri, 17 Feb 2023 19:29:12 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2542D80411 for ; Sat, 18 Feb 2023 00:29:12 +0000 (UTC) X-FDA: 80478528144.23.96028AE Received: from mail-vk1-f202.google.com (mail-vk1-f202.google.com [209.85.221.202]) by imf13.hostedemail.com (Postfix) with ESMTP id 5FE9520016 for ; Sat, 18 Feb 2023 00:29:10 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=qVyA3qUq; spf=pass (imf13.hostedemail.com: domain of 31RvwYwoKCPIdnbioabnihaiiafY.Wigfchor-ggepUWe.ila@flex--jthoughton.bounces.google.com designates 209.85.221.202 as permitted sender) smtp.mailfrom=31RvwYwoKCPIdnbioabnihaiiafY.Wigfchor-ggepUWe.ila@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676680150; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=R2na1A3NSq7U/MTCBc/o5RGQOMMtDEqSAD5VSD0flvE=; b=8QttuLgwVkpHu0Zdgk9jehwu8uCs6tZSzQbFPfUgQ/F+vpfoKg0Wu+LZkhJWTPAC0n6j/U l5WwSa8AE48+aWkRy2N2tQdKM2uUg+PjLI5nnRE4cv8qbyy6xgAZz8W8OnzdaKygSTNyaS IGO3OwTWcqkfFFhvV//P+CZHpbG0gdo= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=qVyA3qUq; spf=pass (imf13.hostedemail.com: domain of 31RvwYwoKCPIdnbioabnihaiiafY.Wigfchor-ggepUWe.ila@flex--jthoughton.bounces.google.com designates 209.85.221.202 as permitted sender) smtp.mailfrom=31RvwYwoKCPIdnbioabnihaiiafY.Wigfchor-ggepUWe.ila@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676680150; a=rsa-sha256; cv=none; b=lE0rrnlQwfPjUeRXR3ruGEYlOnwnUq84UtpvYArtYHocPuYu0ZZeQN41A22j/A5OFVa19c 5t2HACtBerYooOmZ30/Irr5FFP5dNzIqbRiWAcq9OsHJfEXNP0GTekMD8wE6jd2x14MHEt yJ8oCF5/Q5uT+5S/TY8Sbu2kcNrQUlI= Received: by mail-vk1-f202.google.com with SMTP id f9-20020ac5c9a9000000b00401cb01aff3so792616vkm.4 for ; Fri, 17 Feb 2023 16:29:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1676680149; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=R2na1A3NSq7U/MTCBc/o5RGQOMMtDEqSAD5VSD0flvE=; b=qVyA3qUqF5DHCviCI1nzfYS5Svk9ua2LpWd4a99ORevkgEpjI4dqg4lKQMb+bwNcNw 61c9ND7a9iH3goStVFiSljoFRjNY2j1AhhPNcUU/a1rv5fdHxnLbmQMVtti88Q+JYZyU bhe8TGck/nYHhFokZ4sDeNAoyxCO64fiBBLXbHmrXkJokroObrlP3/h9q8bTGXc3eo/F vBbNamFNBm7arbW972qTZ0yke+aKbVBelBbPkEYjM+gx8b1eyLRItOwCX8k0eelqQ1oo E6X1WzYSjvE5m5sQqtV1xVs+q8GAKHv2jxgseAPVQAnj0ZSKEohG90BS+LNhWTC4WS5w 8pnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1676680149; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=R2na1A3NSq7U/MTCBc/o5RGQOMMtDEqSAD5VSD0flvE=; b=R/QLo+NBShDYhr5o9XBiMx1cO4F+oLYEKxMQT8zlZbLyBBIInTZcwD/ZbqhGFkIOHM Vkv/wGwdiq79jHITPW2QA1urCtebOpWfMAvzmO/U3QOSf53nCqs+iGjW6vHXjn5PPG1C rM6Ojr8vwm4CwTzdyDsdkH/J9LwshqcV41XFZPKaY9xU4BvGbzrVkM4ZZdgsc+YLs0Sa Dr6NXf7QZd/YiColZn5pHNaElxXy2+kr1QThOzREn/ceN9+Psuz2JJogMpdpuW7fHJnM Eac0sxunuKr3i+f+R/c6pKM0BZOQjddKz8klN55TA3qWLcqckne4h8icOHKnvZxGHMIP 1kAw== X-Gm-Message-State: AO0yUKUDeO9N/fGiUZwW3T/KQB6KIipWfm8BMJfM2YKbjudDuBJh6QJO J3bIeBJMho9EmwFiry0j/EeHZD6t8x08aaPZ X-Google-Smtp-Source: AK7set+z+B4A4WuUUUfTfMJ3HPbCsVBPAnASJYuSG63wOfEVQp9exRkXKeR5pjRe9t+Ysvo+wmN1lJQLga4KIPTk X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a67:c485:0:b0:412:4cf3:d0ed with SMTP id d5-20020a67c485000000b004124cf3d0edmr38832vsk.32.1676680149589; Fri, 17 Feb 2023 16:29:09 -0800 (PST) Date: Sat, 18 Feb 2023 00:27:59 +0000 In-Reply-To: <20230218002819.1486479-1-jthoughton@google.com> Mime-Version: 1.0 References: <20230218002819.1486479-1-jthoughton@google.com> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog Message-ID: <20230218002819.1486479-27-jthoughton@google.com> Subject: [PATCH v2 26/46] mm: rmap: provide pte_order in page_vma_mapped_walk From: James Houghton To: Mike Kravetz , Muchun Song , Peter Xu , Andrew Morton Cc: David Hildenbrand , David Rientjes , Axel Rasmussen , Mina Almasry , "Zach O'Keefe" , Manish Mishra , Naoya Horiguchi , "Dr . David Alan Gilbert" , "Matthew Wilcox (Oracle)" , Vlastimil Babka , Baolin Wang , Miaohe Lin , Yang Shi , Frank van der Linden , Jiaqi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, James Houghton X-Stat-Signature: 8uefhtqxesyy8nmccc4xtextyktparde X-Rspam-User: X-Rspamd-Queue-Id: 5FE9520016 X-Rspamd-Server: rspam06 X-HE-Tag: 1676680150-723332 X-HE-Meta: U2FsdGVkX1/XbVp9PfzP5dh+ClOv0BjyjIFvgjVrs6RYD0XYjV40vAD2KEEWBXE0Oy/5haI674Gbx+niEztDBKkoBKxDFUX6CaZvysEc7ab27CGG8Y0ChW98Nn+jsxRnDpwlcDjZxwcs0kffCim0sbGllTUlwhv5h2YWpblzV0Lnk2lDX3881IbYFMMwiY8Yi/HVoRYvOfO4iKytGI5GjP4wDYMbGMxjIjiGG7YDMHr/QMRjF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dJE6+gYSrvQXwAdENixlMKC7mGzgoqOqwpDL3LuKxQ6piTSwljqel08tGXowXUfTxg4bcYyUj+k4LPvMeJIglkO1uxFJnc4U/kFoS/9eWTJOv0Cw7WGaoQDwQo2WG52w2tVP0Lw4cr5fzK9Z6/eRkQxIxJnMJEXRwlsk+U9Sc3VK/OnzXJp2TjKLCcQkBBZxz4IJlbhtfyXsC1vPdkvm57c1odGNogG7ppeFf4xrQuHsc3mINMOXYM2AaF+0GS6e2YcDcSvaFR/APMJqRl/4IB+dfpRJugmpvslhTfF5Kv77WLF3Ftl9Ay8tdtbRr/ZATD0jttu2eBDfHZSq2tCySxIxetQLl1EQI4aWvu/1ONF0BBqy6Th3Gke0GAU= 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: page_vma_mapped_walk callers will need this information to know how HugeTLB pages are mapped. pte_order only applies if pte is not NULL. Signed-off-by: James Houghton diff --git a/include/linux/rmap.h b/include/linux/rmap.h index a4570da03e58..87a2c7f422bf 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -387,6 +387,7 @@ struct page_vma_mapped_walk { pmd_t *pmd; pte_t *pte; spinlock_t *ptl; + unsigned int pte_order; unsigned int flags; }; diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c index 4e448cfbc6ef..08295b122ad6 100644 --- a/mm/page_vma_mapped.c +++ b/mm/page_vma_mapped.c @@ -16,6 +16,7 @@ static inline bool not_found(struct page_vma_mapped_walk *pvmw) static bool map_pte(struct page_vma_mapped_walk *pvmw) { pvmw->pte = pte_offset_map(pvmw->pmd, pvmw->address); + pvmw->pte_order = 0; if (!(pvmw->flags & PVMW_SYNC)) { if (pvmw->flags & PVMW_MIGRATION) { if (!is_swap_pte(*pvmw->pte)) @@ -177,6 +178,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) if (!pvmw->pte) return false; + pvmw->pte_order = huge_page_order(hstate); pvmw->ptl = huge_pte_lock(hstate, mm, pvmw->pte); if (!check_pte(pvmw)) return not_found(pvmw); @@ -272,6 +274,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) } pte_unmap(pvmw->pte); pvmw->pte = NULL; + pvmw->pte_order = 0; goto restart; } pvmw->pte++;