From patchwork Mon Feb 17 05:03:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 11385221 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12A95139A for ; Mon, 17 Feb 2020 05:04:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E728F20718 for ; Mon, 17 Feb 2020 05:04:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E728F20718 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A84C26B0006; Mon, 17 Feb 2020 00:04:15 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A352D6B0007; Mon, 17 Feb 2020 00:04:15 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94B2A6B0008; Mon, 17 Feb 2020 00:04:15 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 7B9266B0006 for ; Mon, 17 Feb 2020 00:04:15 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 195A6283A for ; Mon, 17 Feb 2020 05:04:15 +0000 (UTC) X-FDA: 76498427670.05.money11_7c5a0b7c64a56 X-Spam-Summary: 2,0,0,ed7a213e97499f65,d41d8cd98f00b204,anshuman.khandual@arm.com,::linux-kernel@vger.kernel.org:anshuman.khandual@arm.com:rostedt@goodmis.org:mingo@redhat.com,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1345:1359:1431:1437:1534:1540:1568:1711:1714:1730:1747:1777:1792:1963:2393:2559:2562:2890:3138:3139:3140:3141:3142:3865:4042:4321:5007:6261:8634:10004:11026:11473:11658:11914:12043:12296:12297:12438:12555:12895:12986:13069:13311:13357:14181:14384:14394:14721:21080:21450:21451:21627:30001:30029:30054,0,RBL:217.140.110.172:@arm.com:.lbl8.mailshell.net-62.2.0.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:17,LUA_SUMMARY:none X-HE-Tag: money11_7c5a0b7c64a56 X-Filterd-Recvd-Size: 1995 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Feb 2020 05:04:14 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B30E3101E; Sun, 16 Feb 2020 21:04:13 -0800 (PST) Received: from p8cg001049571a15.blr.arm.com (p8cg001049571a15.blr.arm.com [10.162.16.95]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0AD3C3F703; Sun, 16 Feb 2020 21:04:11 -0800 (PST) From: Anshuman Khandual To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Anshuman Khandual , Steven Rostedt , Ingo Molnar Subject: [PATCH 1/5] mm/vma: Add missing VMA flag readable name for VM_SYNC Date: Mon, 17 Feb 2020 10:33:49 +0530 Message-Id: <1581915833-21984-2-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1581915833-21984-1-git-send-email-anshuman.khandual@arm.com> References: <1581915833-21984-1-git-send-email-anshuman.khandual@arm.com> 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: This just adds the missing readable name for VM_SYNC. Cc: Steven Rostedt Cc: Ingo Molnar Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- include/trace/events/mmflags.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index a1675d43777e..5fb752034386 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -154,6 +154,7 @@ IF_HAVE_PG_IDLE(PG_idle, "idle" ) {VM_ACCOUNT, "account" }, \ {VM_NORESERVE, "noreserve" }, \ {VM_HUGETLB, "hugetlb" }, \ + {VM_SYNC, "sync" }, \ __VM_ARCH_SPECIFIC_1 , \ {VM_WIPEONFORK, "wipeonfork" }, \ {VM_DONTDUMP, "dontdump" }, \ From patchwork Mon Feb 17 05:03:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 11385231 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 92279138D for ; Mon, 17 Feb 2020 05:04:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F90B20718 for ; Mon, 17 Feb 2020 05:04:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F90B20718 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8FDEC6B0007; Mon, 17 Feb 2020 00:04:22 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8ADC56B0008; Mon, 17 Feb 2020 00:04:22 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C5BE6B000A; Mon, 17 Feb 2020 00:04:22 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0208.hostedemail.com [216.40.44.208]) by kanga.kvack.org (Postfix) with ESMTP id 63C126B0007 for ; Mon, 17 Feb 2020 00:04:22 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0BA74181AEF00 for ; Mon, 17 Feb 2020 05:04:22 +0000 (UTC) X-FDA: 76498427964.02.fish48_7d52f2e97ec14 X-Spam-Summary: 2,0,0,29797dc2dd447e33,d41d8cd98f00b204,anshuman.khandual@arm.com,::linux-kernel@vger.kernel.org:anshuman.khandual@arm.com:guoren@kernel.org:geert@linux-m68k.org:ralf@linux-mips.org:paulburton@kernel.org:benh@kernel.crashing.org:paulus@samba.org:mpe@ellerman.id.au:ysato@users.sourceforge.jp:dalias@libc.org:dave.hansen@linux.intel.com:luto@kernel.org:peterz@infradead.org:tglx@linutronix.de:mingo@redhat.com:akpm@linux-foundation.org:rostedt@goodmis.org:mgorman@suse.de:linux-m68k@lists.linux-m68k.org:linux-mips@vger.kernel.org:linuxppc-dev@lists.ozlabs.org:linux-sh@vger.kernel.org,RULES_HIT:2:41:355:379:541:800:960:973:988:989:1260:1261:1345:1359:1431:1437:1535:1605:1730:1747:1777:1792:1963:2393:2559:2562:2898:2901:3138:3139:3140:3141:3142:3865:3867:3868:3870:3871:3872:3874:4049:4119:4250:4321:4605:5007:6261:6742:6743:7903:8634:9592:10004:11026:11473:11657:11658:11914:12043:12296:12297:12438:12555:12895:12986:13846:14096:14394:21063:21080:21451:21627:21740:21990: 30003:30 X-HE-Tag: fish48_7d52f2e97ec14 X-Filterd-Recvd-Size: 8587 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Feb 2020 05:04:21 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B8081FB; Sun, 16 Feb 2020 21:04:20 -0800 (PST) Received: from p8cg001049571a15.blr.arm.com (p8cg001049571a15.blr.arm.com [10.162.16.95]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3017F3F703; Sun, 16 Feb 2020 21:04:13 -0800 (PST) From: Anshuman Khandual To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Anshuman Khandual , Guo Ren , Geert Uytterhoeven , Ralf Baechle , Paul Burton , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Yoshinori Sato , Rich Felker , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Andrew Morton , Steven Rostedt , Mel Gorman , linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org Subject: [PATCH 2/5] mm/vma: Make vma_is_accessible() available for general use Date: Mon, 17 Feb 2020 10:33:50 +0530 Message-Id: <1581915833-21984-3-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1581915833-21984-1-git-send-email-anshuman.khandual@arm.com> References: <1581915833-21984-1-git-send-email-anshuman.khandual@arm.com> 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: Lets move vma_is_accessible() helper to include/linux/mm.h which makes it available for general use. While here, this replaces all remaining open encodings for VMA access check with vma_is_accessible(). Cc: Guo Ren Cc: Geert Uytterhoeven Cc: Paul Burton Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Yoshinori Sato Cc: Rich Felker Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Andrew Morton Cc: Steven Rostedt Cc: Mel Gorman Cc: linux-kernel@vger.kernel.org Cc: linux-m68k@lists.linux-m68k.org Cc: linux-mips@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-sh@vger.kernel.org Cc: linux-mm@kvack.org Signed-off-by: Anshuman Khandual Acked-by: Geert Uytterhoeven Acked-by: Guo Ren --- arch/csky/mm/fault.c | 2 +- arch/m68k/mm/fault.c | 2 +- arch/mips/mm/fault.c | 2 +- arch/powerpc/mm/fault.c | 2 +- arch/sh/mm/fault.c | 2 +- arch/x86/mm/fault.c | 2 +- include/linux/mm.h | 5 +++++ kernel/sched/fair.c | 2 +- mm/gup.c | 2 +- mm/memory.c | 5 ----- mm/mempolicy.c | 3 +-- 11 files changed, 14 insertions(+), 15 deletions(-) diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c index f76618b630f9..4b3511b8298d 100644 --- a/arch/csky/mm/fault.c +++ b/arch/csky/mm/fault.c @@ -137,7 +137,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, if (!(vma->vm_flags & VM_WRITE)) goto bad_area; } else { - if (!(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) + if (!vma_is_accessible(vma)) goto bad_area; } diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c index e9b1d7585b43..d5131ec5d923 100644 --- a/arch/m68k/mm/fault.c +++ b/arch/m68k/mm/fault.c @@ -125,7 +125,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, case 1: /* read, present */ goto acc_err; case 0: /* read, not present */ - if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) + if (!vma_is_accessible(vma)) goto acc_err; } diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c index 1e8d00793784..5b9f947bfa32 100644 --- a/arch/mips/mm/fault.c +++ b/arch/mips/mm/fault.c @@ -142,7 +142,7 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write, goto bad_area; } } else { - if (!(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) + if (!vma_is_accessible(vma)) goto bad_area; } } diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index 8db0507619e2..71a3658c516b 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -314,7 +314,7 @@ static bool access_error(bool is_write, bool is_exec, return false; } - if (unlikely(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))) + if (unlikely(!vma_is_accessible(vma))) return true; /* * We should ideally do the vma pkey access check here. But in the diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c index 5f51456f4fc7..a8c4253f37d7 100644 --- a/arch/sh/mm/fault.c +++ b/arch/sh/mm/fault.c @@ -355,7 +355,7 @@ static inline int access_error(int error_code, struct vm_area_struct *vma) return 1; /* read, not present: */ - if (unlikely(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))) + if (unlikely(!vma_is_accessible(vma))) return 1; return 0; diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index fa4ea09593ab..c461eaab0306 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -1200,7 +1200,7 @@ access_error(unsigned long error_code, struct vm_area_struct *vma) return 1; /* read, not present: */ - if (unlikely(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))) + if (unlikely(!vma_is_accessible(vma))) return 1; return 0; diff --git a/include/linux/mm.h b/include/linux/mm.h index 52269e56c514..b0e53ef13ff1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -541,6 +541,11 @@ static inline bool vma_is_anonymous(struct vm_area_struct *vma) return !vma->vm_ops; } +static inline bool vma_is_accessible(struct vm_area_struct *vma) +{ + return vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC); +} + #ifdef CONFIG_SHMEM /* * The vma_is_shmem is not inline because it is used only by slow diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index fe4e0d775375..6ce54d57dd09 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2573,7 +2573,7 @@ static void task_numa_work(struct callback_head *work) * Skip inaccessible VMAs to avoid any confusion between * PROT_NONE and NUMA hinting ptes */ - if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) + if (!vma_is_accessible(vma)) continue; do { diff --git a/mm/gup.c b/mm/gup.c index 1b521e0ac1de..c8ffe2e61f03 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1171,7 +1171,7 @@ long populate_vma_page_range(struct vm_area_struct *vma, * We want mlock to succeed for regions that have any permissions * other than PROT_NONE. */ - if (vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC)) + if (vma_is_accessible(vma)) gup_flags |= FOLL_FORCE; /* diff --git a/mm/memory.c b/mm/memory.c index 0bccc622e482..2f07747612b7 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3942,11 +3942,6 @@ static inline vm_fault_t wp_huge_pmd(struct vm_fault *vmf, pmd_t orig_pmd) return VM_FAULT_FALLBACK; } -static inline bool vma_is_accessible(struct vm_area_struct *vma) -{ - return vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE); -} - static vm_fault_t create_huge_pud(struct vm_fault *vmf) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 977c641f78cf..91c1ad6ab8ea 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -649,8 +649,7 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end, if (flags & MPOL_MF_LAZY) { /* Similar to task_numa_work, skip inaccessible VMAs */ - if (!is_vm_hugetlb_page(vma) && - (vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)) && + if (!is_vm_hugetlb_page(vma) && vma_is_accessible(vma) && !(vma->vm_flags & VM_MIXEDMAP)) change_prot_numa(vma, start, endvma); return 1; From patchwork Mon Feb 17 05:03:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 11385233 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04F03139A for ; Mon, 17 Feb 2020 05:04:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CFAF62070B for ; Mon, 17 Feb 2020 05:04:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFAF62070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 04B656B0008; Mon, 17 Feb 2020 00:04:27 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F3E4F6B000A; Mon, 17 Feb 2020 00:04:26 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E54BB6B000C; Mon, 17 Feb 2020 00:04:26 -0500 (EST) X-Original-To: linux-mm@kvack.org 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 CCEEA6B0008 for ; Mon, 17 Feb 2020 00:04:26 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 71B032C06 for ; Mon, 17 Feb 2020 05:04:26 +0000 (UTC) X-FDA: 76498428132.10.wave43_7e0a2d6455714 X-Spam-Summary: 2,0,0,030b6900dda34476,d41d8cd98f00b204,anshuman.khandual@arm.com,::linux-kernel@vger.kernel.org:anshuman.khandual@arm.com:paulus@ozlabs.org:benh@kernel.crashing.org:mpe@ellerman.id.au:viro@zeniv.linux.org.uk:will@kernel.org:aneesh.kumar@linux.ibm.com:akpm@linux-foundation.org:npiggin@gmail.com:peterz@infradead.org:arnd@arndb.de:mingo@redhat.com:acme@kernel.org:kvm-ppc@vger.kernel.org:linuxppc-dev@lists.ozlabs.org:linux-fsdevel@vger.kernel.org:linux-arch@vger.kernel.org,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1345:1359:1431:1437:1535:1543:1711:1730:1747:1777:1792:1963:1981:2194:2199:2393:2559:2562:2693:3138:3139:3140:3141:3142:3354:3865:3867:3871:3874:4321:4605:5007:6261:6742:7514:8634:9036:10004:11026:11473:11658:11914:12043:12114:12296:12297:12438:12555:12895:12986:13255:13846:14096:14181:14394:14721:21080:21451:21627:30054:30070,0,RBL:217.140.110.172:@arm.com:.lbl8.mailshell.net-62.2.0.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netc heck:non X-HE-Tag: wave43_7e0a2d6455714 X-Filterd-Recvd-Size: 5055 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Feb 2020 05:04:26 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AE0E81063; Sun, 16 Feb 2020 21:04:25 -0800 (PST) Received: from p8cg001049571a15.blr.arm.com (p8cg001049571a15.blr.arm.com [10.162.16.95]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BC20F3F703; Sun, 16 Feb 2020 21:04:20 -0800 (PST) From: Anshuman Khandual To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Anshuman Khandual , Paul Mackerras , Benjamin Herrenschmidt , Michael Ellerman , Alexander Viro , Will Deacon , "Aneesh Kumar K.V" , Andrew Morton , Nick Piggin , Peter Zijlstra , Arnd Bergmann , Ingo Molnar , Arnaldo Carvalho de Melo , kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org Subject: [PATCH 3/5] mm/vma: Replace all remaining open encodings with is_vm_hugetlb_page() Date: Mon, 17 Feb 2020 10:33:51 +0530 Message-Id: <1581915833-21984-4-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1581915833-21984-1-git-send-email-anshuman.khandual@arm.com> References: <1581915833-21984-1-git-send-email-anshuman.khandual@arm.com> 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: This replaces all remaining open encodings with is_vm_hugetlb_page(). Cc: Paul Mackerras Cc: Benjamin Herrenschmidt Cc: Michael Ellerman Cc: Alexander Viro Cc: Will Deacon Cc: "Aneesh Kumar K.V" Cc: Andrew Morton Cc: Nick Piggin Cc: Peter Zijlstra Cc: Arnd Bergmann Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: kvm-ppc@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-mm@kvack.org Signed-off-by: Anshuman Khandual Reported-by: kbuild test robot --- arch/powerpc/kvm/e500_mmu_host.c | 2 +- fs/binfmt_elf.c | 2 +- include/asm-generic/tlb.h | 2 +- kernel/events/core.c | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c index 425d13806645..3922575a1c31 100644 --- a/arch/powerpc/kvm/e500_mmu_host.c +++ b/arch/powerpc/kvm/e500_mmu_host.c @@ -422,7 +422,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500, break; } } else if (vma && hva >= vma->vm_start && - (vma->vm_flags & VM_HUGETLB)) { + (is_vm_hugetlb_page(vma))) { unsigned long psize = vma_kernel_pagesize(vma); tsize = (gtlbe->mas1 & MAS1_TSIZE_MASK) >> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index f4713ea76e82..6bc97ede10ba 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1317,7 +1317,7 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma, } /* Hugetlb memory check */ - if (vma->vm_flags & VM_HUGETLB) { + if (is_vm_hugetlb_page(vma)) { if ((vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_SHARED)) goto whole; if (!(vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_PRIVATE)) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index f391f6b500b4..d42c236d4965 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -398,7 +398,7 @@ tlb_update_vma_flags(struct mmu_gather *tlb, struct vm_area_struct *vma) * We rely on tlb_end_vma() to issue a flush, such that when we reset * these values the batch is empty. */ - tlb->vma_huge = !!(vma->vm_flags & VM_HUGETLB); + tlb->vma_huge = is_vm_hugetlb_page(vma); tlb->vma_exec = !!(vma->vm_flags & VM_EXEC); } diff --git a/kernel/events/core.c b/kernel/events/core.c index e453589da97c..eb0ee3c5f322 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -7693,7 +7694,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) flags |= MAP_EXECUTABLE; if (vma->vm_flags & VM_LOCKED) flags |= MAP_LOCKED; - if (vma->vm_flags & VM_HUGETLB) + if (is_vm_hugetlb_page(vma)) flags |= MAP_HUGETLB; if (file) { From patchwork Mon Feb 17 05:03:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 11385237 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1241138D for ; Mon, 17 Feb 2020 05:04:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A895F2070B for ; Mon, 17 Feb 2020 05:04:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A895F2070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BBCE46B000A; Mon, 17 Feb 2020 00:04:30 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B6C5A6B000C; Mon, 17 Feb 2020 00:04:30 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A84106B000D; Mon, 17 Feb 2020 00:04:30 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0048.hostedemail.com [216.40.44.48]) by kanga.kvack.org (Postfix) with ESMTP id 90B436B000A for ; Mon, 17 Feb 2020 00:04:30 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 35E738248047 for ; Mon, 17 Feb 2020 05:04:30 +0000 (UTC) X-FDA: 76498428300.25.touch84_7e9687baff20b X-Spam-Summary: 2,0,0,154d1edbb6f4bd31,d41d8cd98f00b204,anshuman.khandual@arm.com,::linux-kernel@vger.kernel.org:anshuman.khandual@arm.com:sudeep.dutt@intel.com:ashutosh.dixit@intel.com:arnd@arndb.de:gregkh@linuxfoundation.org:tglx@linutronix.de:kstewart@linuxfoundation.org:allison@lohutok.net:rfontana@redhat.com,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1345:1359:1431:1437:1534:1541:1711:1730:1747:1777:1792:1963:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3867:3870:4321:5007:6261:8634:10004:11026:11657:11658:11914:12043:12297:12555:12895:12986:13069:13255:13311:13357:14096:14181:14384:14394:14721:21080:21451:21627:21987:30054:30064,0,RBL:217.140.110.172:@arm.com:.lbl8.mailshell.net-62.2.0.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: touch84_7e9687baff20b X-Filterd-Recvd-Size: 2633 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Feb 2020 05:04:29 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 42DA9106F; Sun, 16 Feb 2020 21:04:29 -0800 (PST) Received: from p8cg001049571a15.blr.arm.com (p8cg001049571a15.blr.arm.com [10.162.16.95]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2A2293F703; Sun, 16 Feb 2020 21:04:25 -0800 (PST) From: Anshuman Khandual To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Anshuman Khandual , Sudeep Dutt , Ashutosh Dixit , Arnd Bergmann , Greg Kroah-Hartman , Thomas Gleixner , Kate Stewart , Allison Randal , Richard Fontana Subject: [PATCH 4/5] mm/vma: Replace all remaining open encodings with vma_set_anonymous() Date: Mon, 17 Feb 2020 10:33:52 +0530 Message-Id: <1581915833-21984-5-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1581915833-21984-1-git-send-email-anshuman.khandual@arm.com> References: <1581915833-21984-1-git-send-email-anshuman.khandual@arm.com> 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: This replaces all remaining open encodings with vma_set_anonymous(). Cc: Sudeep Dutt Cc: Ashutosh Dixit Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Thomas Gleixner Cc: Kate Stewart Cc: Allison Randal Cc: Richard Fontana Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- drivers/misc/mic/scif/scif_mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/mic/scif/scif_mmap.c b/drivers/misc/mic/scif/scif_mmap.c index a151d416f39c..1f0dec5df994 100644 --- a/drivers/misc/mic/scif/scif_mmap.c +++ b/drivers/misc/mic/scif/scif_mmap.c @@ -580,7 +580,7 @@ static void scif_munmap(struct vm_area_struct *vma) * The kernel probably zeroes these out but we still want * to clean up our own mess just in case. */ - vma->vm_ops = NULL; + vma_set_anonymous(vma); vma->vm_private_data = NULL; kref_put(&vmapvt->ref, vma_pvt_release); scif_delete_vma(ep, vma); From patchwork Mon Feb 17 05:03:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 11385241 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38B78139A for ; Mon, 17 Feb 2020 05:04:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 18E5F2070B for ; Mon, 17 Feb 2020 05:04:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 18E5F2070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9797D6B000C; Mon, 17 Feb 2020 00:04:32 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8D56A6B000D; Mon, 17 Feb 2020 00:04:32 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C50E6B000E; Mon, 17 Feb 2020 00:04:32 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0080.hostedemail.com [216.40.44.80]) by kanga.kvack.org (Postfix) with ESMTP id 63CC46B000C for ; Mon, 17 Feb 2020 00:04:32 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id ECA8E180AD811 for ; Mon, 17 Feb 2020 05:04:31 +0000 (UTC) X-FDA: 76498428342.14.soup80_7eda5ea00091b X-Spam-Summary: 2,0,0,d5e1640aedb04e5b,d41d8cd98f00b204,anshuman.khandual@arm.com,::linux-kernel@vger.kernel.org:anshuman.khandual@arm.com:akpm@linux-foundation.org,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1345:1359:1431:1437:1534:1540:1711:1714:1730:1747:1777:1792:1963:2393:2559:2562:3138:3139:3140:3141:3142:3351:3872:3876:4321:5007:6261:8634:10004:11026:11658:11914:12297:12555:12895:13069:13255:13311:13357:13846:14096:14181:14384:14394:14721:21080:21451:21627:21990:30054,0,RBL:217.140.110.172:@arm.com:.lbl8.mailshell.net-62.2.0.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: soup80_7eda5ea00091b X-Filterd-Recvd-Size: 2023 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Feb 2020 05:04:31 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2E4E511D4; Sun, 16 Feb 2020 21:04:31 -0800 (PST) Received: from p8cg001049571a15.blr.arm.com (p8cg001049571a15.blr.arm.com [10.162.16.95]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B28FC3F703; Sun, 16 Feb 2020 21:04:29 -0800 (PST) From: Anshuman Khandual To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Anshuman Khandual , Andrew Morton Subject: [PATCH 5/5] mm/vma: Replace all remaining open encodings with vma_is_anonymous() Date: Mon, 17 Feb 2020 10:33:53 +0530 Message-Id: <1581915833-21984-6-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1581915833-21984-1-git-send-email-anshuman.khandual@arm.com> References: <1581915833-21984-1-git-send-email-anshuman.khandual@arm.com> 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: This replaces all remaining open encodings with vma_is_anonymous(). Cc: Andrew Morton Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- mm/gup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index c8ffe2e61f03..58c8cbfeded6 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -146,7 +146,8 @@ static struct page *no_page_table(struct vm_area_struct *vma, * But we can only make this optimization where a hole would surely * be zero-filled if handle_mm_fault() actually did handle it. */ - if ((flags & FOLL_DUMP) && (!vma->vm_ops || !vma->vm_ops->fault)) + if ((flags & FOLL_DUMP) && + (vma_is_anonymous(vma) || !vma->vm_ops->fault)) return ERR_PTR(-EFAULT); return NULL; }