From patchwork Thu Jan 20 04:25:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 12718245 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 92384C433F5 for ; Thu, 20 Jan 2022 04:25:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF7406B00BE; Wed, 19 Jan 2022 23:25:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ACFEC6B00C3; Wed, 19 Jan 2022 23:25:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A1906B00BE; Wed, 19 Jan 2022 23:25:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0157.hostedemail.com [216.40.44.157]) by kanga.kvack.org (Postfix) with ESMTP id 8B3BB6B00BE for ; Wed, 19 Jan 2022 23:25:18 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3A188951B3 for ; Thu, 20 Jan 2022 04:25:18 +0000 (UTC) X-FDA: 79049375916.23.A17E247 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by imf15.hostedemail.com (Postfix) with ESMTP id D87C4A000B for ; Thu, 20 Jan 2022 04:25:17 +0000 (UTC) Received: by mail-qt1-f175.google.com with SMTP id 14so4315348qty.2 for ; Wed, 19 Jan 2022 20:25:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BRQvkyJfLwToXuPc9CF9KmCDMc31zinjyrsWOern8Tg=; b=nJDYI+ciV99Z/2F42EEsoomiaC+ya+hPY7wXcTLaV8orJZZj9z3SMp/plXHCWl5cS1 CjalBl/ubSwiXr07vJolWHPVQsCQxXmvj7C9W4XP4ZKfKKvPlFdnmmyrkA6tSHcWFUwt +lqzXkTC/TqMCbCJ30bsNb+vs9/4Jz/LSZsutlbldHGW3bNNjJD/M1DCsO0d9IJvSKg7 nK5WnQ/nOaERaP9v3ERmIwRCacKEiK0XayC8pzXoHN9cwj8fLscp5sAVzEeciyBkD+F0 xyYG9r3oxse8h/o6fEtLDgoYwtzVmiUcgRmx41gp5q9hXwb1tUxW4UJn3QOtC5HZwuhg prCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BRQvkyJfLwToXuPc9CF9KmCDMc31zinjyrsWOern8Tg=; b=lQrMZPfyjGpkU6mGHm1knSM5zWBV4Q9wal3DX6lT9gtFJEr+bbd+xmymr8rzmZFeOW xd1drWlUAVg/1t6bX09M7RwAuOyycnVdE2IJu/VViOTIq7nNQkwAc2T/Zyx8e1R2cLD7 2T/b6tNx4XYBU7hLT5nKVf1MmIIsP3s3pv5ALUMeaOXVh0eZt/LKcLNaE2/J/VmMNKDe rxFjKKfZam/wfj1wu1YT3hLkYyRpFVxsq5Iwr9RaT0BrtkkKPK2SJ5ED7ZsewoeCRDmE vj5sZNye8sMZTuZhRJoLxRr5zpX+AuRX+GwYRPdFY8eEUnwHZqiX7k4CeIKq2gAzKY/s 2j6w== X-Gm-Message-State: AOAM533yTg9GxUPoG9pLp43WB6g3JkJdcCdcm9gxsZDxkP5fPRR05PVq fz6xozjSrUNSoOTL6X0/uxJ3Vw== X-Google-Smtp-Source: ABdhPJwPUQaGDfTZBgEZrsyNqiqF3s5J39OTgoUAisRbJTqg5M+ibUW/EknbldLh2q9bXECqc7BGFA== X-Received: by 2002:a05:622a:3cd:: with SMTP id k13mr14439260qtx.458.1642652717142; Wed, 19 Jan 2022 20:25:17 -0800 (PST) Received: from soleen.c.googlers.com.com (189.216.85.34.bc.googleusercontent.com. [34.85.216.189]) by smtp.gmail.com with ESMTPSA id n22sm927228qka.46.2022.01.19.20.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 20:25:16 -0800 (PST) From: Pasha Tatashin To: pasha.tatashin@soleen.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, rientjes@google.com, pjt@google.com, weixugc@google.com, gthelen@google.com, mingo@redhat.com, will@kernel.org, rppt@kernel.org, dave.hansen@linux.intel.com, hpa@zytor.com, aneesh.kumar@linux.ibm.com, jirislaby@kernel.org, songmuchun@bytedance.com, qydwhotmail@gmail.com, hughd@google.com, ziy@nvidia.com, anshuman.khandual@arm.com Subject: [PATCH 1/3] mm/debug_vm_pgtable: remove pte entry from the page table Date: Thu, 20 Jan 2022 04:25:11 +0000 Message-Id: <20220120042513.1648831-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220120042513.1648831-1-pasha.tatashin@soleen.com> References: <20220120042513.1648831-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: D87C4A000B X-Stat-Signature: wo8bd41u3s4b7bd3fowejk1qjmun7rbj Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=nJDYI+ci; spf=pass (imf15.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.175 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none X-HE-Tag: 1642652717-620967 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: The pte entry that is used in pte_advanced_tests() is never removed from the page table at the end of the test. The issue is detected by page_table_check, to repro compile kernel with the following configs: CONFIG_DEBUG_VM_PGTABLE=y CONFIG_PAGE_TABLE_CHECK=y CONFIG_PAGE_TABLE_CHECK_ENFORCED=y During the boot the following BUG is printed: [ 7.483050][ T1] debug_vm_pgtable: [debug_vm_pgtable ]: Validating architecture page tabs [ 7.490930][ T1] ------------[ cut here ]------------ [ 7.494926][ T1] kernel BUG at mm/page_table_check.c:194! [ 7.499172][ T1] invalid opcode: 0000 [#1] PREEMPT SMP KASAN [ 7.503610][ T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.16.0+ [ 7.508600][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, ... The entry should be properly removed from the page table before the page is released to the free list. Fixes: a5c3b9ffb0f4 ("mm/debug_vm_pgtable: add tests validating advanced arch page table helpers") Signed-off-by: Pasha Tatashin Reviewed-by: Zi Yan and Tested-by: Zi Yan --- mm/debug_vm_pgtable.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index a7ac97c76762..f7c5970f1719 100644 --- a/mm/debug_vm_pgtable.c +++ b/mm/debug_vm_pgtable.c @@ -171,6 +171,7 @@ static void __init pte_advanced_tests(struct pgtable_debug_args *args) ptep_test_and_clear_young(args->vma, args->vaddr, args->ptep); pte = ptep_get(args->ptep); WARN_ON(pte_young(pte)); + ptep_get_and_clear_full(args->mm, args->vaddr, args->ptep, 1); } static void __init pte_savedwrite_tests(struct pgtable_debug_args *args) From patchwork Thu Jan 20 04:25:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 12718246 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 79BFAC4332F for ; Thu, 20 Jan 2022 04:25:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE1516B00C5; Wed, 19 Jan 2022 23:25:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B43726B00C4; Wed, 19 Jan 2022 23:25:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 96E296B00C5; Wed, 19 Jan 2022 23:25:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id 878F16B00C3 for ; Wed, 19 Jan 2022 23:25:19 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 3D1358170961 for ; Thu, 20 Jan 2022 04:25:19 +0000 (UTC) X-FDA: 79049375958.22.0F271C8 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by imf22.hostedemail.com (Postfix) with ESMTP id D15ECC0013 for ; Thu, 20 Jan 2022 04:25:18 +0000 (UTC) Received: by mail-qt1-f174.google.com with SMTP id c3so2553022qtc.8 for ; Wed, 19 Jan 2022 20:25:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=nKZbvnKqUABkXpOqTg5mpojiJ4GqEoBKOOiPWM73Qxw=; b=bu7EWjQ32HnOd5DIeVyrxkiwHfYyZeU1n3WqXyfs6V8TzykoyKOhzXQUF5Xj35f3td vJ91pwx58PU7M7jxX2L7kJlm3pjn9WI6OhAlG5I+jBj/mKTjIs4F8byCHLNodvmqPI23 KDga4e2ajDKFSN+ZzIs6fs6gtUJ527vE3zNBvOC/Jm6AAYkgtH8HNrd88igosq9JGtHK 8MTKLhi13hLvpsrhKUwTl8Q/JpgX1qSYMFIZo8XR0kL8fjGiFiGf0p/vK8obLPk+CPm3 cE0aQEFlpuCQ6RDom4qL0xWd1opvo7KHBpFQOeDaD2j0ddMVRnkE1Pdo15RLGxD+k7ap +4Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nKZbvnKqUABkXpOqTg5mpojiJ4GqEoBKOOiPWM73Qxw=; b=Ra71XQo2AZj+FpNp3BP1UFTf3KGBE8fr7TpbcCIw1gS6BW6HavjtX6YB6MDJTzzVLG 3RVVBOc34972zgRUcqseBrgUh1yTqHnMcoR+oIiADY7UVLis0BXfiURaQB+2Cy3Ed3Iy Mn+nbS7GYd5w52ILNZYqjai6GJ6fk3IU44kJzQ5yPYJcR0Hx+vK03w0HQyo5cwPLe8N+ W2A07aPvePJhvZ6b4KM5GSpS978RbfBw9UyyAKMYG6ViYPssk18DQ8u6Vzggdnf0AYMv IzEzT38ID7pf3nOB3kze00/QMHqpxFNqpi/5RU0zhrXgosrsjj+ChrUv+/uxeRWE28WN mg/w== X-Gm-Message-State: AOAM530hetSQreGn/nqm342rr31My0DgwtlA7dnysT6/sbtjW9YdlfNV CRnh/XCcU2BF/fUDNQRBWfY25g== X-Google-Smtp-Source: ABdhPJwDDA5NIRNSeOLvTEcxsAy5nszcqa0qbDh0l+wfx933/17zCvV7fpoerVnAqcsbC4bItVnryw== X-Received: by 2002:ac8:574e:: with SMTP id 14mr12632481qtx.626.1642652718132; Wed, 19 Jan 2022 20:25:18 -0800 (PST) Received: from soleen.c.googlers.com.com (189.216.85.34.bc.googleusercontent.com. [34.85.216.189]) by smtp.gmail.com with ESMTPSA id n22sm927228qka.46.2022.01.19.20.25.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 20:25:17 -0800 (PST) From: Pasha Tatashin To: pasha.tatashin@soleen.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, rientjes@google.com, pjt@google.com, weixugc@google.com, gthelen@google.com, mingo@redhat.com, will@kernel.org, rppt@kernel.org, dave.hansen@linux.intel.com, hpa@zytor.com, aneesh.kumar@linux.ibm.com, jirislaby@kernel.org, songmuchun@bytedance.com, qydwhotmail@gmail.com, hughd@google.com, ziy@nvidia.com, anshuman.khandual@arm.com Subject: [PATCH 2/3] mm/page_table_check: check entries at pud and pmd levels Date: Thu, 20 Jan 2022 04:25:12 +0000 Message-Id: <20220120042513.1648831-3-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220120042513.1648831-1-pasha.tatashin@soleen.com> References: <20220120042513.1648831-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: D15ECC0013 X-Stat-Signature: ckm98f4t8c7o3qjmpzkfoz7b7h6wpwrz Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=bu7EWjQ3; spf=pass (imf22.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.174 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none X-Rspamd-Server: rspam07 X-HE-Tag: 1642652718-498452 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: syzbot detected a case where the page table counters were not properly updated. syzkaller login: ------------[ cut here ]------------ kernel BUG at mm/page_table_check.c:162! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 3099 Comm: pasha Not tainted 5.16.0+ #48 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIO4 RIP: 0010:__page_table_check_zero+0x159/0x1a0 Code: 7d 3a b2 ff 45 39 f5 74 2a e8 43 38 b2 ff 4d 85 e4 01 RSP: 0018:ffff888010667418 EFLAGS: 00010293 RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000 RDX: ffff88800cea8680 RSI: ffffffff81becaf9 RDI: 0000000003 RBP: ffff888010667450 R08: 0000000000000001 R09: 0000000000 R10: ffffffff81becaab R11: 0000000000000001 R12: ffff888008 R13: 0000000000000001 R14: 0000000000000200 R15: dffffc0000 FS: 0000000000000000(0000) GS:ffff888035e00000(0000) knlG0 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffd875cad00 CR3: 00000000094ce000 CR4: 0000000000 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000 Call Trace: free_pcp_prepare+0x3be/0xaa0 free_unref_page+0x1c/0x650 ? trace_hardirqs_on+0x6a/0x1d0 free_compound_page+0xec/0x130 free_transhuge_page+0x1be/0x260 __put_compound_page+0x90/0xd0 release_pages+0x54c/0x1060 ? filemap_remove_folio+0x161/0x210 ? lock_downgrade+0x720/0x720 ? __put_page+0x150/0x150 ? filemap_free_folio+0x164/0x350 __pagevec_release+0x7c/0x110 shmem_undo_range+0x85e/0x1250 ... The repro involved having a huge page that is split due to uprobe event temporarily replacing one of the pages in the huge page. Later the huge page was combined again, but the counters were off, as the PTE level was not properly updated. Make sure that not only huge page but also small pages are updated when a new entry is set or cleared. Fixes: df4e817b7108 ("mm: page table check") Signed-off-by: Pasha Tatashin --- mm/page_table_check.c | 52 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 7504e7caa2a1..2341ac382cd5 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -145,6 +145,40 @@ static void page_table_check_set(struct mm_struct *mm, unsigned long addr, } } +static void pte_clear_level(struct mm_struct *mm, unsigned long addr, + pte_t *ptep) +{ + unsigned long i; + + for (i = 0; i < PTRS_PER_PTE; i++) { + __page_table_check_pte_clear(mm, addr, *ptep); + addr += PAGE_SIZE; + ptep++; + } +} + +static void pmd_clear_level(struct mm_struct *mm, unsigned long addr, + pmd_t *pmdp) +{ + unsigned long i; + + for (i = 0; i < PTRS_PER_PMD; i++) { + pmd_t old_pmd = *pmdp; + + if (pmd_user_accessible_page(old_pmd)) { + page_table_check_clear(mm, addr, pmd_pfn(old_pmd), + PMD_PAGE_SIZE >> PAGE_SHIFT); + } else if (!pmd_bad(old_pmd) && !pmd_leaf(old_pmd)) { + pte_t *ptep = pte_offset_map(&old_pmd, addr); + + pte_clear_level(mm, addr, ptep); + pte_unmap(ptep); + } + addr += PMD_PAGE_SIZE; + pmdp++; + } +} + /* * page is on free list, or is being allocated, verify that counters are zeroes * crash if they are not. @@ -186,6 +220,11 @@ void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr, if (pmd_user_accessible_page(pmd)) { page_table_check_clear(mm, addr, pmd_pfn(pmd), PMD_PAGE_SIZE >> PAGE_SHIFT); + } else if (!pmd_bad(pmd) && !pmd_leaf(pmd)) { + pte_t *ptep = pte_offset_map(&pmd, addr); + + pte_clear_level(mm, addr, ptep); + pte_unmap(ptep); } } EXPORT_SYMBOL(__page_table_check_pmd_clear); @@ -199,6 +238,10 @@ void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, if (pud_user_accessible_page(pud)) { page_table_check_clear(mm, addr, pud_pfn(pud), PUD_PAGE_SIZE >> PAGE_SHIFT); + } else if (!pud_bad(pud) && !pud_leaf(pud)) { + pmd_t *pmdp = pmd_offset(&pud, addr); + + pmd_clear_level(mm, addr, pmdp); } } EXPORT_SYMBOL(__page_table_check_pud_clear); @@ -237,6 +280,11 @@ void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr, if (pmd_user_accessible_page(old_pmd)) { page_table_check_clear(mm, addr, pmd_pfn(old_pmd), PMD_PAGE_SIZE >> PAGE_SHIFT); + } else if (!pmd_bad(old_pmd) && !pmd_leaf(old_pmd)) { + pte_t *ptep = pte_offset_map(&old_pmd, addr); + + pte_clear_level(mm, addr, ptep); + pte_unmap(ptep); } if (pmd_user_accessible_page(pmd)) { @@ -259,6 +307,10 @@ void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr, if (pud_user_accessible_page(old_pud)) { page_table_check_clear(mm, addr, pud_pfn(old_pud), PUD_PAGE_SIZE >> PAGE_SHIFT); + } else if (!pud_bad(old_pud) && !pud_leaf(old_pud)) { + pmd_t *pmdp = pmd_offset(&old_pud, addr); + + pmd_clear_level(mm, addr, pmdp); } if (pud_user_accessible_page(pud)) { From patchwork Thu Jan 20 04:25:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 12718247 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 239D0C433FE for ; Thu, 20 Jan 2022 04:25:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA6EB6B00C8; Wed, 19 Jan 2022 23:25:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C075C6B00C6; Wed, 19 Jan 2022 23:25:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD0706B00C8; Wed, 19 Jan 2022 23:25:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 9DA446B00C4 for ; Wed, 19 Jan 2022 23:25:20 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4EFE8181A2923 for ; Thu, 20 Jan 2022 04:25:20 +0000 (UTC) X-FDA: 79049376000.24.1F1D362 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by imf22.hostedemail.com (Postfix) with ESMTP id F0A76C0013 for ; Thu, 20 Jan 2022 04:25:19 +0000 (UTC) Received: by mail-qt1-f178.google.com with SMTP id w6so4315325qtk.4 for ; Wed, 19 Jan 2022 20:25:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=y7IBEFcOTZK1CyuqmdTSoA/WSm/rs2AzBzr4xeRbGk4=; b=cP4MRZVN3XS/Hv+4xVejRohrtY7eWhls6EeKtXKO4HEeZoBodcI8sJ3xjHKFm70JUO GOILpJJKMku8FMRco38M2XxNrQ3llQ6nlbmn4kLPAuunEYXWUZCP6iupyYGhZoGylgYn VVxbLPGmi2UseBBddwmDeApHQ6oG35Z8Cl9i1SxnXv4Ts6hutw3/Bo78JiROOyWn2dOQ 46AG77KO7iiByksR54vPpIIQYFqIR50aL6Gp+tj/UmoKeVU0Lm1M9ykxCEaNheyPQ5BT uv4iuIUZD696lO4zpJJBuZgLzkSwzL1LCMOqQH8s1atbsUTMU8QwZ4FtkGxQxBFhlB3a CZew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y7IBEFcOTZK1CyuqmdTSoA/WSm/rs2AzBzr4xeRbGk4=; b=uBsxrvF4ahXGx1F89w39zZYEBDjbrpUl1X84ca5RahQ9Z1nKFC2NUpZfth9vQH8DXn QHCJmdBvtWkoKu3InjNTfNjXlmipQmWuG4rGmg/B7p56t3a/AxzWbLjhp9eOzZRZRBlG Zjd941pSeW2Winu7aB2+4WmbswpNMuZ4LqZW4ocx2/Nu3eSDnoANx0xIoaiVuFv7i3Cv ZbYSYh5YO3Djmf1ZgbSUP/3yLccK/NK91QmHJ5X+WfMAD678/K9yu65Toh/LBwgR4H0Y ZDH84cyHumROpGz2zVKTrjOVtEOzzfhNUUZmNOhJDM8QCXDAyAl0z7xyZVwzZkbdrc7N ds4g== X-Gm-Message-State: AOAM532sQ9Rnmm9iTn9eUvlMiuxzmZkbjBKJhJE/VND55+NjgO1FFFiW 81rXCn3wLQlRVDJVXAYhFAHc0g== X-Google-Smtp-Source: ABdhPJzXnIXjyCxa1o9CUucEgZlUWjvyPBMb3mux6mDsG/2GD/N9CkUGpolKakTZ0SXWX3g03RR0ZQ== X-Received: by 2002:ac8:5d94:: with SMTP id d20mr27466383qtx.214.1642652719229; Wed, 19 Jan 2022 20:25:19 -0800 (PST) Received: from soleen.c.googlers.com.com (189.216.85.34.bc.googleusercontent.com. [34.85.216.189]) by smtp.gmail.com with ESMTPSA id n22sm927228qka.46.2022.01.19.20.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 20:25:18 -0800 (PST) From: Pasha Tatashin To: pasha.tatashin@soleen.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, rientjes@google.com, pjt@google.com, weixugc@google.com, gthelen@google.com, mingo@redhat.com, will@kernel.org, rppt@kernel.org, dave.hansen@linux.intel.com, hpa@zytor.com, aneesh.kumar@linux.ibm.com, jirislaby@kernel.org, songmuchun@bytedance.com, qydwhotmail@gmail.com, hughd@google.com, ziy@nvidia.com, anshuman.khandual@arm.com Subject: [PATCH 3/3] mm/page_table_check: use unsigned long for page counters Date: Thu, 20 Jan 2022 04:25:13 +0000 Message-Id: <20220120042513.1648831-4-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220120042513.1648831-1-pasha.tatashin@soleen.com> References: <20220120042513.1648831-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: F0A76C0013 X-Stat-Signature: tkwqzdk7tz3g4d5dqd38uzyx3zsxpc83 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=cP4MRZVN; spf=pass (imf22.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.178 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none X-HE-Tag: 1642652719-847755 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: For the consistency, use "unsigned long" for all page counters. Signed-off-by: Pasha Tatashin Reviewed-by: Wei Xu --- mm/page_table_check.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 2341ac382cd5..22dd285ab8d5 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -86,8 +86,8 @@ static void page_table_check_clear(struct mm_struct *mm, unsigned long addr, { struct page_ext *page_ext; struct page *page; + unsigned long i; bool anon; - int i; if (!pfn_valid(pfn)) return; @@ -121,8 +121,8 @@ static void page_table_check_set(struct mm_struct *mm, unsigned long addr, { struct page_ext *page_ext; struct page *page; + unsigned long i; bool anon; - int i; if (!pfn_valid(pfn)) return; @@ -186,10 +186,10 @@ static void pmd_clear_level(struct mm_struct *mm, unsigned long addr, void __page_table_check_zero(struct page *page, unsigned int order) { struct page_ext *page_ext = lookup_page_ext(page); - int i; + unsigned long i; BUG_ON(!page_ext); - for (i = 0; i < (1 << order); i++) { + for (i = 0; i < (1ul << order); i++) { struct page_table_check *ptc = get_page_table_check(page_ext); BUG_ON(atomic_read(&ptc->anon_map_count));