From patchwork Thu Jan 20 19:12:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 12718989 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 21D20C4332F for ; Thu, 20 Jan 2022 19:12:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D0CAB6B0083; Thu, 20 Jan 2022 14:12:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BCAB96B0095; Thu, 20 Jan 2022 14:12:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 932DD6B0085; Thu, 20 Jan 2022 14:12:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay029.a.hostedemail.com [64.99.140.29]) by kanga.kvack.org (Postfix) with ESMTP id 7BE436B0083 for ; Thu, 20 Jan 2022 14:12:55 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2BB29229CC for ; Thu, 20 Jan 2022 19:12:55 +0000 (UTC) X-FDA: 79051612710.03.773DAFC Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by imf15.hostedemail.com (Postfix) with ESMTP id B5A9CA0059 for ; Thu, 20 Jan 2022 19:12:54 +0000 (UTC) Received: by mail-qv1-f52.google.com with SMTP id a7so7833742qvl.1 for ; Thu, 20 Jan 2022 11:12:54 -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=ljRHzu8EIti/rwgbKsna6fOCiQbES3TZ5TTYfFv0egw=; b=FyNEAIm/3bE5CybyyukETOQ/BQa7EhXGoW8WaHTc5aG9OMBkNDJ0v0IxBNUDBn7JcJ qY/Fi2S4h5MYwXg4pELzsxmpyzOLEYq5cf2kR4ObXgaUcpEEl2M/8hR0/838NFa4RUSh WMTlEm+f/O2OesyO8SbAkTVyfRj1k0LXXgkfmAv2CLxhI/SCnWhAEE+c+pi15uDOQIs3 ANyEOssIBASnEYRn3/chz8M8SCXLBshno7oN6a78RV+aHElzwXJ6zmpR+KJIcE4XkWl9 egN5vg3Y9WPN//dCaL2OGEjhy1+Jc4eFmdmfTmJlVB7og/sM0WoHgVXCEne2nAaG44EU S1+w== 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=ljRHzu8EIti/rwgbKsna6fOCiQbES3TZ5TTYfFv0egw=; b=nHR3Jv4ADBaJZ6r9fvhrupdAN0As0xbcqtJdEiJngj5z03mTiD4ZV2v0A5dC4H99q0 DHALGZ6Da/qoGu1PE47SpBTCsEz9SA/659hcJ26zUgfbof0Fhz3/qPZg23ATccneL90m FZJdYxflHq1knPPFoihOyzbnHcXD0WBjPasLJ9bidLbHd9rly+RFaWJ+8WWAaHtVfGED ojBJIdTQSYtvFYye7m37xNOOxtjg55thGh1Fkdz3trqb3X7uYTtIBIabJWj4pCXjIgsB 8TxWhv8A2bLj9Eh/xjXK8Wmh9fLLVQKg9iLzTatr0p7eonFQMQ8ZxVQpYohMiWagATpR SKHg== X-Gm-Message-State: AOAM530lhMqKIUln7EkAmxGG6AvQCMsxADaRRT7L38Wn0lSx3/mlyXhE DNl+9mmmYlzbFxLoio31hMh9Uw== X-Google-Smtp-Source: ABdhPJy2i251uJu/EMC4DLi9WRnxHlaT88/Fup2DjBtaR+0+svTyX1C9lcQd1dHZttx5/jijgXaJNg== X-Received: by 2002:a05:6214:20a4:: with SMTP id 4mr384015qvd.7.1642705974062; Thu, 20 Jan 2022 11:12:54 -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 w1sm1822509qko.40.2022.01.20.11.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 11:12:53 -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 v2 1/3] mm/debug_vm_pgtable: remove pte entry from the page table Date: Thu, 20 Jan 2022 19:12:48 +0000 Message-Id: <20220120191250.2671557-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220120191250.2671557-1-pasha.tatashin@soleen.com> References: <20220120191250.2671557-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B5A9CA0059 X-Stat-Signature: ca6knws4gfp3585ai66mju8kq7f7gbfb Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b="FyNEAIm/"; spf=pass (imf15.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.52 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none X-HE-Tag: 1642705974-456068 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 Tested-by: Zi Yan --- mm/debug_vm_pgtable.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index a7ac97c76762..db2abd9e415b 100644 --- a/mm/debug_vm_pgtable.c +++ b/mm/debug_vm_pgtable.c @@ -171,6 +171,8 @@ 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 19:12:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 12718990 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 E1324C43217 for ; Thu, 20 Jan 2022 19:12:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 936226B0085; Thu, 20 Jan 2022 14:12:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 820EA6B0092; Thu, 20 Jan 2022 14:12:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C0E26B0095; Thu, 20 Jan 2022 14:12:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5D8D56B0085 for ; Thu, 20 Jan 2022 14:12:56 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 19BEB181D1A16 for ; Thu, 20 Jan 2022 19:12:56 +0000 (UTC) X-FDA: 79051612752.04.5C230A6 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) by imf25.hostedemail.com (Postfix) with ESMTP id BC872A005F for ; Thu, 20 Jan 2022 19:12:55 +0000 (UTC) Received: by mail-qk1-f170.google.com with SMTP id j85so7278528qke.2 for ; Thu, 20 Jan 2022 11:12:55 -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=zdhQ37gTy669jxm5MfPtrCEbBTPzaXPL9fEyLC9GrfM=; b=acbHonsDujIZqvIlBu3ScdQMbDpcDthc62uw0hIhKjw14Pyp0QhM65c0oAl3q/d3nA MhvzqoBFKI+lpp3Gxd/U4waC2haiFKxbEnPAA1+WgQegnl2G7ABtbgjPhiM0Yubc3lls RZ4JyHubTI2JjhzUXV480GSF/mlrgM66+dox4csGG8pxhCyHskBSuUILiW+aFs6Z0/vE 1EVm8aBeGY49R5jZ+F6qL3/5nnDfw3CStv7qHQcRLurFatHzEMioBjDmA6KZplGQmJmm uTUq6imMyxQ2KHpcE2ZXnkrPw1slvh+G9X/1Cj9pz6bApltRsHg9vk2XySBhCuy5Q9Hp qyJg== 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=zdhQ37gTy669jxm5MfPtrCEbBTPzaXPL9fEyLC9GrfM=; b=EjIE5BVKPqOc110/bVJFYTJ+BZeatC3wG2WC+PimM7czJia7l5b+57PlABqYT2gxfP F9oz9K+bdJDr14os4oUlzrj1uSL7nc8YFnsWgwZgqP80O8y/gdtaGhGafOxwD+QvyuFx qCtrhsfxdrJRYaBVz841sJlD9OBmnBgh4EltbV4orYsYUP8BEx2FN8hLtFX9tvkagEfk LyFIf9YKe8lJ/pt2LH/5dN3q1nfQ/DH7PO2K0oKB630BF0W/s/clbvZ04WdT5VHj7pFW 1CehR2SQcCFN4J6tiyVomVHf3QXtocUP/3j3jlaPr7EY4Me7cZhB8AOry/9em3ms7M0q nZSA== X-Gm-Message-State: AOAM533XLo/2VNagcwayXjDWi7beTdwaqLBv9uen+2+ULymKbneu+W89 P+gjjBiDuoC7Y7sX1B30uc3dyQ== X-Google-Smtp-Source: ABdhPJw8EzgzG83pHzYvqX5rdn6x63o0CAsToMH5cNIpJhgaFS0q8fMX/f6IRu2cPZtoGvh49xptxQ== X-Received: by 2002:a37:a8d6:: with SMTP id r205mr226689qke.716.1642705975032; Thu, 20 Jan 2022 11:12:55 -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 w1sm1822509qko.40.2022.01.20.11.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 11:12:54 -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 v2 2/3] mm/page_table_check: check entries at pud and pmd levels Date: Thu, 20 Jan 2022 19:12:49 +0000 Message-Id: <20220120191250.2671557-3-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220120191250.2671557-1-pasha.tatashin@soleen.com> References: <20220120191250.2671557-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: BC872A005F X-Stat-Signature: t36rk8wrzptfzk6z5qtyr4ybb4jf377p Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=acbHonsD; dmarc=none; spf=pass (imf25.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.170 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com X-HE-Tag: 1642705975-39443 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 Reviewed-by: Wei Xu --- mm/page_table_check.c | 60 ++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 7504e7caa2a1..877d967742bc 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -145,6 +145,30 @@ 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++) { + __page_table_check_pmd_clear(mm, addr, *pmdp); + 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 +210,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 +228,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); @@ -206,17 +239,10 @@ EXPORT_SYMBOL(__page_table_check_pud_clear); void __page_table_check_pte_set(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { - pte_t old_pte; - if (&init_mm == mm) return; - old_pte = *ptep; - if (pte_user_accessible_page(old_pte)) { - page_table_check_clear(mm, addr, pte_pfn(old_pte), - PAGE_SIZE >> PAGE_SHIFT); - } - + __page_table_check_pte_clear(mm, addr, *ptep); if (pte_user_accessible_page(pte)) { page_table_check_set(mm, addr, pte_pfn(pte), PAGE_SIZE >> PAGE_SHIFT, @@ -228,17 +254,10 @@ EXPORT_SYMBOL(__page_table_check_pte_set); void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, pmd_t pmd) { - pmd_t old_pmd; - if (&init_mm == mm) return; - 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); - } - + __page_table_check_pmd_clear(mm, addr, *pmdp); if (pmd_user_accessible_page(pmd)) { page_table_check_set(mm, addr, pmd_pfn(pmd), PMD_PAGE_SIZE >> PAGE_SHIFT, @@ -250,17 +269,10 @@ EXPORT_SYMBOL(__page_table_check_pmd_set); void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr, pud_t *pudp, pud_t pud) { - pud_t old_pud; - if (&init_mm == mm) return; - old_pud = *pudp; - if (pud_user_accessible_page(old_pud)) { - page_table_check_clear(mm, addr, pud_pfn(old_pud), - PUD_PAGE_SIZE >> PAGE_SHIFT); - } - + __page_table_check_pud_clear(mm, addr, *pudp); if (pud_user_accessible_page(pud)) { page_table_check_set(mm, addr, pud_pfn(pud), PUD_PAGE_SIZE >> PAGE_SHIFT, From patchwork Thu Jan 20 19:12:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 12718991 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 11DC6C433EF for ; Thu, 20 Jan 2022 19:13:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DEFEE6B0092; Thu, 20 Jan 2022 14:12:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DA0846B0095; Thu, 20 Jan 2022 14:12:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA7C16B0096; Thu, 20 Jan 2022 14:12:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0181.hostedemail.com [216.40.44.181]) by kanga.kvack.org (Postfix) with ESMTP id A7A1F6B0092 for ; Thu, 20 Jan 2022 14:12:58 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5E5F592E0D for ; Thu, 20 Jan 2022 19:12:58 +0000 (UTC) X-FDA: 79051612836.08.3B252D1 Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by imf12.hostedemail.com (Postfix) with ESMTP id 049F74003C for ; Thu, 20 Jan 2022 19:12:56 +0000 (UTC) Received: by mail-qv1-f43.google.com with SMTP id a8so7853557qvx.2 for ; Thu, 20 Jan 2022 11:12:56 -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=/lrhieXAQjpkgK4+rimVAixmRMROqE/GcACBpp2RziA=; b=DVbJt984cdsTf0nLyL0gU+CRPeI6csgRuWb0tYVjhrI1WKObUvjWiJH3vkiFqxeXv6 DGDPkwoRX5AKCXqVNns18Tl1MheshVE0QOVPsw+a5azPgWxiRQlnp8toELV+g+0koCpD EXmmlh0mVnvWi3Bd9TaiLKo1E++CJb2OBDNan93i7tO9ODFWsRVISd8blF1c+C7BZqOW AcM5kBPI9Zta1hy4wePoAnTjZ7kNNY6TJp538BwMkMc3Yl49am02dp6618Wso6ozgF4e 4+Ri0un9Nw1/L0A2LhfqJ+KCGA9Tr3cym3CSlFBCIMGmaGB091V2I7z7tPgcXu1I+DM2 3lzQ== 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=/lrhieXAQjpkgK4+rimVAixmRMROqE/GcACBpp2RziA=; b=z9aYQYuxB9iWAIRf04jw/y6kDQ0zz3ksjEKQUSVpa64QqWqLAQQNYw4bXeLd9Ri41A ESsjPTtKcY3tIsb/Dfz5tB9HegKcM33uK84moA+itXw3iH1e54u0rjLUhXFQw55VmfFf +PcTnY6QXIODDv5F3hwYkBM5mEAimRQqUgYtklEQUboUC/lVoYvjbedjx7MtfUiC3yTh 2B2oaOGHUFMD3oxFPtl9rKcz9JcV9KOweqz4fTB6QKn9WIM1arKAb2i2fLXNKiJITiMT iweB4RCcH1IsJE1gm4lOKbyZ1Wj6YwMyCpx4BmTlMuSsWnhpunb3M6qO/hqyXF+6lk4O kZ6Q== X-Gm-Message-State: AOAM532YHgtqS1Ucwj1AP+VojxCGN4KQ2rPbvXlZhcm1cOsKSLZ74wv6 txEoa2b0kKqKKw/fLcnuxnKhlA== X-Google-Smtp-Source: ABdhPJzX9ogZQNd0p5asU4lyl7+h+DwhcECJON4g0QSGJOOD4M1nujIMQK+391N6XK1gOndyju7qjQ== X-Received: by 2002:a05:6214:2428:: with SMTP id gy8mr359142qvb.117.1642705975967; Thu, 20 Jan 2022 11:12:55 -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 w1sm1822509qko.40.2022.01.20.11.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 11:12:55 -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 v2 3/3] mm/page_table_check: use unsigned long for page counters Date: Thu, 20 Jan 2022 19:12:50 +0000 Message-Id: <20220120191250.2671557-4-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220120191250.2671557-1-pasha.tatashin@soleen.com> References: <20220120191250.2671557-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Stat-Signature: gs3bj1xbksejqotdq8j71yd3xjs894rb Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=DVbJt984; dmarc=none; spf=pass (imf12.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.43 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 049F74003C X-HE-Tag: 1642705976-26469 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 877d967742bc..f1db4de8bed2 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; @@ -176,10 +176,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));