From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f200.google.com (mail-qt0-f200.google.com [209.85.216.200]) by kanga.kvack.org (Postfix) with ESMTP id 2D4806B0253 for ; Wed, 1 Feb 2017 18:37:55 -0500 (EST) Received: by mail-qt0-f200.google.com with SMTP id x49so411069061qtc.7 for ; Wed, 01 Feb 2017 15:37:55 -0800 (PST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com. [66.111.4.25]) by mx.google.com with ESMTPS id 31si15557631qtz.162.2017.02.01.15.37.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 15:37:54 -0800 (PST) From: "Tobin C. Harding" Subject: [PATCH 0/4] mm: trivial sparse and checkpatch fixes Date: Thu, 2 Feb 2017 10:37:16 +1100 Message-Id: <1485992240-10986-1-git-send-email-me@tobin.cc> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko , Tobin C Harding From: Tobin C Harding This patchset fixes trivial sparse and checkpatch errors/warnings. The majority of the changes are whitespace only. The only code changes are replace 0 with NULL, and remove extraneous braces around single statement. Patchset aims to only make changes when they objectively increase the cleanliness of the code, does not touch line over 80 warnings. Changes have been tested by building and booting kernel. Tobin C Harding (4): mm: Fix sparse, use plain integer as NULL pointer mm: Fix checkpatch warnings, whitespace mm: Fix checkpatch errors, whitespace errors mm: Fix checkpatch warning, extraneous braces mm/memory.c | 66 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 32 insertions(+), 34 deletions(-) -- 2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f198.google.com (mail-qt0-f198.google.com [209.85.216.198]) by kanga.kvack.org (Postfix) with ESMTP id 0A8446B025E for ; Wed, 1 Feb 2017 18:37:58 -0500 (EST) Received: by mail-qt0-f198.google.com with SMTP id g49so413317962qta.0 for ; Wed, 01 Feb 2017 15:37:58 -0800 (PST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com. [66.111.4.25]) by mx.google.com with ESMTPS id c43si15549320qte.145.2017.02.01.15.37.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 15:37:57 -0800 (PST) From: "Tobin C. Harding" Subject: [PATCH 1/4] mm: Fix sparse, use plain integer as NULL pointer Date: Thu, 2 Feb 2017 10:37:17 +1100 Message-Id: <1485992240-10986-2-git-send-email-me@tobin.cc> In-Reply-To: <1485992240-10986-1-git-send-email-me@tobin.cc> References: <1485992240-10986-1-git-send-email-me@tobin.cc> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko , Tobin C Harding From: Tobin C Harding Patch fixes sparse warning: Using plain integer as NULL pointer. Replaces assignment of 0 to pointer with NULL assignment. Signed-off-by: Tobin C Harding --- mm/memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 6bf2b47..cc5fa12 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2905,7 +2905,7 @@ static int pte_alloc_one_map(struct vm_fault *vmf) atomic_long_inc(&vma->vm_mm->nr_ptes); pmd_populate(vma->vm_mm, vmf->pmd, vmf->prealloc_pte); spin_unlock(vmf->ptl); - vmf->prealloc_pte = 0; + vmf->prealloc_pte = NULL; } else if (unlikely(pte_alloc(vma->vm_mm, vmf->pmd, vmf->address))) { return VM_FAULT_OOM; } @@ -2953,7 +2953,7 @@ static void deposit_prealloc_pte(struct vm_fault *vmf) * count that as nr_ptes. */ atomic_long_inc(&vma->vm_mm->nr_ptes); - vmf->prealloc_pte = 0; + vmf->prealloc_pte = NULL; } static int do_set_pmd(struct vm_fault *vmf, struct page *page) @@ -3359,7 +3359,7 @@ static int do_fault(struct vm_fault *vmf) /* preallocated pagetable is unused: free it */ if (vmf->prealloc_pte) { pte_free(vma->vm_mm, vmf->prealloc_pte); - vmf->prealloc_pte = 0; + vmf->prealloc_pte = NULL; } return ret; } -- 2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f198.google.com (mail-qt0-f198.google.com [209.85.216.198]) by kanga.kvack.org (Postfix) with ESMTP id 1246E6B025E for ; Wed, 1 Feb 2017 18:38:01 -0500 (EST) Received: by mail-qt0-f198.google.com with SMTP id c25so167224887qtg.2 for ; Wed, 01 Feb 2017 15:38:01 -0800 (PST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com. [66.111.4.25]) by mx.google.com with ESMTPS id m124si13205989qke.228.2017.02.01.15.38.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 15:38:00 -0800 (PST) From: "Tobin C. Harding" Subject: [PATCH 2/4] mm: Fix checkpatch warnings, whitespace Date: Thu, 2 Feb 2017 10:37:18 +1100 Message-Id: <1485992240-10986-3-git-send-email-me@tobin.cc> In-Reply-To: <1485992240-10986-1-git-send-email-me@tobin.cc> References: <1485992240-10986-1-git-send-email-me@tobin.cc> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko , Tobin C Harding From: Tobin C Harding Patch fixes whitespace checkpatch warnings. Signed-off-by: Tobin C Harding --- mm/memory.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index cc5fa12..3562314 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -30,7 +30,7 @@ /* * 05.04.94 - Multi-page memory management added for v1.1. - * Idea by Alex Bligh (alex@cconcepts.co.uk) + * Idea by Alex Bligh (alex@cconcepts.co.uk) * * 16.07.99 - Support of BIGMEM added by Gerhard Wichert, Siemens AG * (Gerhard.Wichert@pdb.siemens.de) @@ -82,9 +82,9 @@ #ifndef CONFIG_NEED_MULTIPLE_NODES /* use the per-pgdat data instead for discontigmem - mbligh */ unsigned long max_mapnr; -struct page *mem_map; - EXPORT_SYMBOL(max_mapnr); + +struct page *mem_map; EXPORT_SYMBOL(mem_map); #endif @@ -96,7 +96,6 @@ EXPORT_SYMBOL(mem_map); * and ZONE_HIGHMEM. */ void * high_memory; - EXPORT_SYMBOL(high_memory); /* @@ -120,10 +119,10 @@ static int __init disable_randmaps(char *s) __setup("norandmaps", disable_randmaps); unsigned long zero_pfn __read_mostly; -unsigned long highest_memmap_pfn __read_mostly; - EXPORT_SYMBOL(zero_pfn); +unsigned long highest_memmap_pfn __read_mostly; + /* * CONFIG_MMU architectures set up ZERO_PAGE in their paging_init() */ @@ -3696,8 +3695,8 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, * VM_FAULT_OOM), there is no need to kill anything. * Just clean up the OOM state peacefully. */ - if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) - mem_cgroup_oom_synchronize(false); + if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) + mem_cgroup_oom_synchronize(false); } /* -- 2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f199.google.com (mail-qt0-f199.google.com [209.85.216.199]) by kanga.kvack.org (Postfix) with ESMTP id 7C3A66B0261 for ; Wed, 1 Feb 2017 18:38:04 -0500 (EST) Received: by mail-qt0-f199.google.com with SMTP id h53so213269125qth.6 for ; Wed, 01 Feb 2017 15:38:04 -0800 (PST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com. [66.111.4.25]) by mx.google.com with ESMTPS id x54si15555050qtc.110.2017.02.01.15.38.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 15:38:03 -0800 (PST) From: "Tobin C. Harding" Subject: [PATCH 3/4] mm: Fix checkpatch errors, whitespace errors Date: Thu, 2 Feb 2017 10:37:19 +1100 Message-Id: <1485992240-10986-4-git-send-email-me@tobin.cc> In-Reply-To: <1485992240-10986-1-git-send-email-me@tobin.cc> References: <1485992240-10986-1-git-send-email-me@tobin.cc> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko , Tobin C Harding From: Tobin C Harding Patch fixes whitespace checkpatch errors. Signed-off-by: Tobin C Harding --- mm/memory.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 3562314..35fb8b2 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -95,7 +95,7 @@ EXPORT_SYMBOL(mem_map); * highstart_pfn must be the same; there must be no gap between ZONE_NORMAL * and ZONE_HIGHMEM. */ -void * high_memory; +void *high_memory; EXPORT_SYMBOL(high_memory); /* @@ -555,7 +555,7 @@ void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *vma, if (is_vm_hugetlb_page(vma)) { hugetlb_free_pgd_range(tlb, addr, vma->vm_end, - floor, next? next->vm_start: ceiling); + floor, next ? next->vm_start : ceiling); } else { /* * Optimization: gather nearby vmas into one call down @@ -568,7 +568,7 @@ void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *vma, unlink_file_vma(vma); } free_pgd_range(tlb, addr, vma->vm_end, - floor, next? next->vm_start: ceiling); + floor, next ? next->vm_start : ceiling); } vma = next; } @@ -1447,10 +1447,10 @@ EXPORT_SYMBOL_GPL(zap_vma_ptes); pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl) { - pgd_t * pgd = pgd_offset(mm, addr); - pud_t * pud = pud_alloc(mm, pgd, addr); + pgd_t *pgd = pgd_offset(mm, addr); + pud_t *pud = pud_alloc(mm, pgd, addr); if (pud) { - pmd_t * pmd = pmd_alloc(mm, pud, addr); + pmd_t *pmd = pmd_alloc(mm, pud, addr); if (pmd) { VM_BUG_ON(pmd_trans_huge(*pmd)); return pte_alloc_map_lock(mm, pmd, addr, ptl); @@ -2509,7 +2509,7 @@ void unmap_mapping_range(struct address_space *mapping, hlen = ULONG_MAX - hba + 1; } - details.check_mapping = even_cows? NULL: mapping; + details.check_mapping = even_cows ? NULL : mapping; details.first_index = hba; details.last_index = hba + hlen - 1; if (details.last_index < details.first_index) @@ -3391,14 +3391,14 @@ static int do_numa_page(struct vm_fault *vmf) int flags = 0; /* - * The "pte" at this point cannot be used safely without - * validation through pte_unmap_same(). It's of NUMA type but - * the pfn may be screwed if the read is non atomic. - * - * We can safely just do a "set_pte_at()", because the old - * page table entry is not accessible, so there would be no - * concurrent hardware modifications to the PTE. - */ + * The "pte" at this point cannot be used safely without + * validation through pte_unmap_same(). It's of NUMA type but + * the pfn may be screwed if the read is non atomic. + * + * We can safely just do a "set_pte_at()", because the old + * page table entry is not accessible, so there would be no + * concurrent hardware modifications to the PTE. + */ vmf->ptl = pte_lockptr(vma->vm_mm, vmf->pmd); spin_lock(vmf->ptl); if (unlikely(!pte_same(*vmf->pte, pte))) { @@ -3689,12 +3689,12 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, if (flags & FAULT_FLAG_USER) { mem_cgroup_oom_disable(); - /* - * The task may have entered a memcg OOM situation but - * if the allocation error was handled gracefully (no - * VM_FAULT_OOM), there is no need to kill anything. - * Just clean up the OOM state peacefully. - */ + /* + * The task may have entered a memcg OOM situation but + * if the allocation error was handled gracefully (no + * VM_FAULT_OOM), there is no need to kill anything. + * Just clean up the OOM state peacefully. + */ if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) mem_cgroup_oom_synchronize(false); } -- 2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f199.google.com (mail-qt0-f199.google.com [209.85.216.199]) by kanga.kvack.org (Postfix) with ESMTP id 5C9B76B026C for ; Wed, 1 Feb 2017 18:38:07 -0500 (EST) Received: by mail-qt0-f199.google.com with SMTP id w20so216203977qtb.3 for ; Wed, 01 Feb 2017 15:38:07 -0800 (PST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com. [66.111.4.25]) by mx.google.com with ESMTPS id t28si15548089qtc.337.2017.02.01.15.38.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 15:38:06 -0800 (PST) From: "Tobin C. Harding" Subject: [PATCH 4/4] mm: Fix checkpatch warning, extraneous braces Date: Thu, 2 Feb 2017 10:37:20 +1100 Message-Id: <1485992240-10986-5-git-send-email-me@tobin.cc> In-Reply-To: <1485992240-10986-1-git-send-email-me@tobin.cc> References: <1485992240-10986-1-git-send-email-me@tobin.cc> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko , Tobin C Harding From: Tobin C Harding Patch fixes checkpatch warning on use of braces around a single statement. Signed-off-by: Tobin C Harding --- mm/memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 35fb8b2..654e6f4 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1128,9 +1128,8 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, arch_enter_lazy_mmu_mode(); do { pte_t ptent = *pte; - if (pte_none(ptent)) { + if (pte_none(ptent)) continue; - } if (pte_present(ptent)) { struct page *page; -- 2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f200.google.com (mail-pf0-f200.google.com [209.85.192.200]) by kanga.kvack.org (Postfix) with ESMTP id 777D26B0274 for ; Wed, 1 Feb 2017 19:48:31 -0500 (EST) Received: by mail-pf0-f200.google.com with SMTP id d123so1670234pfd.0 for ; Wed, 01 Feb 2017 16:48:31 -0800 (PST) Received: from mail-pg0-x236.google.com (mail-pg0-x236.google.com. [2607:f8b0:400e:c05::236]) by mx.google.com with ESMTPS id t2si15861219pgb.296.2017.02.01.16.48.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 16:48:30 -0800 (PST) Received: by mail-pg0-x236.google.com with SMTP id 194so377308pgd.2 for ; Wed, 01 Feb 2017 16:48:30 -0800 (PST) Date: Wed, 1 Feb 2017 16:48:28 -0800 (PST) From: David Rientjes Subject: Re: [PATCH 2/4] mm: Fix checkpatch warnings, whitespace In-Reply-To: <1485992240-10986-3-git-send-email-me@tobin.cc> Message-ID: References: <1485992240-10986-1-git-send-email-me@tobin.cc> <1485992240-10986-3-git-send-email-me@tobin.cc> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: "Tobin C. Harding" Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko On Thu, 2 Feb 2017, Tobin C. Harding wrote: > @@ -3696,8 +3695,8 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, > * VM_FAULT_OOM), there is no need to kill anything. > * Just clean up the OOM state peacefully. > */ > - if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) > - mem_cgroup_oom_synchronize(false); > + if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) > + mem_cgroup_oom_synchronize(false); > } > > /* The comment suffers from the same problem. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f197.google.com (mail-qt0-f197.google.com [209.85.216.197]) by kanga.kvack.org (Postfix) with ESMTP id 23C216B0033 for ; Wed, 1 Feb 2017 22:51:23 -0500 (EST) Received: by mail-qt0-f197.google.com with SMTP id k15so6747445qtg.5 for ; Wed, 01 Feb 2017 19:51:23 -0800 (PST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com. [66.111.4.25]) by mx.google.com with ESMTPS id w62si15951573qkb.124.2017.02.01.19.51.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 19:51:22 -0800 (PST) Date: Thu, 2 Feb 2017 14:51:17 +1100 From: Tobin Harding Subject: Re: [PATCH 2/4] mm: Fix checkpatch warnings, whitespace Message-ID: <20170202035117.GA15650@eros> References: <1485992240-10986-1-git-send-email-me@tobin.cc> <1485992240-10986-3-git-send-email-me@tobin.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: David Rientjes Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko On Wed, Feb 01, 2017 at 04:48:28PM -0800, David Rientjes wrote: > On Thu, 2 Feb 2017, Tobin C. Harding wrote: > > > @@ -3696,8 +3695,8 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, > > * VM_FAULT_OOM), there is no need to kill anything. > > * Just clean up the OOM state peacefully. > > */ > > - if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) > > - mem_cgroup_oom_synchronize(false); > > + if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) > > + mem_cgroup_oom_synchronize(false); > > } > > > > /* > > The comment suffers from the same problem. The comment is fixed in the next patch of the set. The fixes are in separate patches because one was a checkpatch warning and one was an error. Any comments on the structure of the patchset most appreciated. thanks, Tobin. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f199.google.com (mail-wj0-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 3F58E6B0033 for ; Thu, 2 Feb 2017 08:08:29 -0500 (EST) Received: by mail-wj0-f199.google.com with SMTP id jz4so3956966wjb.5 for ; Thu, 02 Feb 2017 05:08:29 -0800 (PST) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com. [2a00:1450:400c:c09::244]) by mx.google.com with ESMTPS id f4si17833767wmf.139.2017.02.02.05.08.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Feb 2017 05:08:27 -0800 (PST) Received: by mail-wm0-x244.google.com with SMTP id c85so4029690wmi.1 for ; Thu, 02 Feb 2017 05:08:27 -0800 (PST) Date: Thu, 2 Feb 2017 16:08:25 +0300 From: "Kirill A. Shutemov" Subject: Re: [PATCH 1/4] mm: Fix sparse, use plain integer as NULL pointer Message-ID: <20170202130825.GA32180@node> References: <1485992240-10986-1-git-send-email-me@tobin.cc> <1485992240-10986-2-git-send-email-me@tobin.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1485992240-10986-2-git-send-email-me@tobin.cc> Sender: owner-linux-mm@kvack.org List-ID: To: "Tobin C. Harding" Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko On Thu, Feb 02, 2017 at 10:37:17AM +1100, Tobin C. Harding wrote: > From: Tobin C Harding > > Patch fixes sparse warning: Using plain integer as NULL pointer. Replaces > assignment of 0 to pointer with NULL assignment. > > Signed-off-by: Tobin C Harding I wrote this part when ARC had pgtable_t defined as 'unsigned long', so NULL wasn't an option, but 0 was as it's valid pointer according to spec. Acked-by: Kirill A. Shutemov -- Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751061AbdBAXh4 (ORCPT ); Wed, 1 Feb 2017 18:37:56 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:39728 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751019AbdBAXhy (ORCPT ); Wed, 1 Feb 2017 18:37:54 -0500 X-ME-Sender: X-Sasl-enc: QHjF2106uZlFRO1efdvAQLFNJRzM214dVdalEfoTqQRb 1485992273 From: "Tobin C. Harding" To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko , Tobin C Harding Subject: [PATCH 0/4] mm: trivial sparse and checkpatch fixes Date: Thu, 2 Feb 2017 10:37:16 +1100 Message-Id: <1485992240-10986-1-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tobin C Harding This patchset fixes trivial sparse and checkpatch errors/warnings. The majority of the changes are whitespace only. The only code changes are replace 0 with NULL, and remove extraneous braces around single statement. Patchset aims to only make changes when they objectively increase the cleanliness of the code, does not touch line over 80 warnings. Changes have been tested by building and booting kernel. Tobin C Harding (4): mm: Fix sparse, use plain integer as NULL pointer mm: Fix checkpatch warnings, whitespace mm: Fix checkpatch errors, whitespace errors mm: Fix checkpatch warning, extraneous braces mm/memory.c | 66 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 32 insertions(+), 34 deletions(-) -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751111AbdBAXiA (ORCPT ); Wed, 1 Feb 2017 18:38:00 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:54748 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066AbdBAXh5 (ORCPT ); Wed, 1 Feb 2017 18:37:57 -0500 X-ME-Sender: X-Sasl-enc: ifQKMgJT50yCg31Y4LpiMuHZ0AAS2DaFJC9ikvhOVXLk 1485992276 From: "Tobin C. Harding" To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko , Tobin C Harding Subject: [PATCH 1/4] mm: Fix sparse, use plain integer as NULL pointer Date: Thu, 2 Feb 2017 10:37:17 +1100 Message-Id: <1485992240-10986-2-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485992240-10986-1-git-send-email-me@tobin.cc> References: <1485992240-10986-1-git-send-email-me@tobin.cc> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tobin C Harding Patch fixes sparse warning: Using plain integer as NULL pointer. Replaces assignment of 0 to pointer with NULL assignment. Signed-off-by: Tobin C Harding --- mm/memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 6bf2b47..cc5fa12 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2905,7 +2905,7 @@ static int pte_alloc_one_map(struct vm_fault *vmf) atomic_long_inc(&vma->vm_mm->nr_ptes); pmd_populate(vma->vm_mm, vmf->pmd, vmf->prealloc_pte); spin_unlock(vmf->ptl); - vmf->prealloc_pte = 0; + vmf->prealloc_pte = NULL; } else if (unlikely(pte_alloc(vma->vm_mm, vmf->pmd, vmf->address))) { return VM_FAULT_OOM; } @@ -2953,7 +2953,7 @@ static void deposit_prealloc_pte(struct vm_fault *vmf) * count that as nr_ptes. */ atomic_long_inc(&vma->vm_mm->nr_ptes); - vmf->prealloc_pte = 0; + vmf->prealloc_pte = NULL; } static int do_set_pmd(struct vm_fault *vmf, struct page *page) @@ -3359,7 +3359,7 @@ static int do_fault(struct vm_fault *vmf) /* preallocated pagetable is unused: free it */ if (vmf->prealloc_pte) { pte_free(vma->vm_mm, vmf->prealloc_pte); - vmf->prealloc_pte = 0; + vmf->prealloc_pte = NULL; } return ret; } -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751194AbdBAXiH (ORCPT ); Wed, 1 Feb 2017 18:38:07 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:34046 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066AbdBAXiE (ORCPT ); Wed, 1 Feb 2017 18:38:04 -0500 X-ME-Sender: X-Sasl-enc: 1yGXpRHTptwER511U96/uMMg0G2HJKsnxkZEUfOZ7hHt 1485992282 From: "Tobin C. Harding" To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko , Tobin C Harding Subject: [PATCH 3/4] mm: Fix checkpatch errors, whitespace errors Date: Thu, 2 Feb 2017 10:37:19 +1100 Message-Id: <1485992240-10986-4-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485992240-10986-1-git-send-email-me@tobin.cc> References: <1485992240-10986-1-git-send-email-me@tobin.cc> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tobin C Harding Patch fixes whitespace checkpatch errors. Signed-off-by: Tobin C Harding --- mm/memory.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 3562314..35fb8b2 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -95,7 +95,7 @@ EXPORT_SYMBOL(mem_map); * highstart_pfn must be the same; there must be no gap between ZONE_NORMAL * and ZONE_HIGHMEM. */ -void * high_memory; +void *high_memory; EXPORT_SYMBOL(high_memory); /* @@ -555,7 +555,7 @@ void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *vma, if (is_vm_hugetlb_page(vma)) { hugetlb_free_pgd_range(tlb, addr, vma->vm_end, - floor, next? next->vm_start: ceiling); + floor, next ? next->vm_start : ceiling); } else { /* * Optimization: gather nearby vmas into one call down @@ -568,7 +568,7 @@ void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *vma, unlink_file_vma(vma); } free_pgd_range(tlb, addr, vma->vm_end, - floor, next? next->vm_start: ceiling); + floor, next ? next->vm_start : ceiling); } vma = next; } @@ -1447,10 +1447,10 @@ EXPORT_SYMBOL_GPL(zap_vma_ptes); pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl) { - pgd_t * pgd = pgd_offset(mm, addr); - pud_t * pud = pud_alloc(mm, pgd, addr); + pgd_t *pgd = pgd_offset(mm, addr); + pud_t *pud = pud_alloc(mm, pgd, addr); if (pud) { - pmd_t * pmd = pmd_alloc(mm, pud, addr); + pmd_t *pmd = pmd_alloc(mm, pud, addr); if (pmd) { VM_BUG_ON(pmd_trans_huge(*pmd)); return pte_alloc_map_lock(mm, pmd, addr, ptl); @@ -2509,7 +2509,7 @@ void unmap_mapping_range(struct address_space *mapping, hlen = ULONG_MAX - hba + 1; } - details.check_mapping = even_cows? NULL: mapping; + details.check_mapping = even_cows ? NULL : mapping; details.first_index = hba; details.last_index = hba + hlen - 1; if (details.last_index < details.first_index) @@ -3391,14 +3391,14 @@ static int do_numa_page(struct vm_fault *vmf) int flags = 0; /* - * The "pte" at this point cannot be used safely without - * validation through pte_unmap_same(). It's of NUMA type but - * the pfn may be screwed if the read is non atomic. - * - * We can safely just do a "set_pte_at()", because the old - * page table entry is not accessible, so there would be no - * concurrent hardware modifications to the PTE. - */ + * The "pte" at this point cannot be used safely without + * validation through pte_unmap_same(). It's of NUMA type but + * the pfn may be screwed if the read is non atomic. + * + * We can safely just do a "set_pte_at()", because the old + * page table entry is not accessible, so there would be no + * concurrent hardware modifications to the PTE. + */ vmf->ptl = pte_lockptr(vma->vm_mm, vmf->pmd); spin_lock(vmf->ptl); if (unlikely(!pte_same(*vmf->pte, pte))) { @@ -3689,12 +3689,12 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, if (flags & FAULT_FLAG_USER) { mem_cgroup_oom_disable(); - /* - * The task may have entered a memcg OOM situation but - * if the allocation error was handled gracefully (no - * VM_FAULT_OOM), there is no need to kill anything. - * Just clean up the OOM state peacefully. - */ + /* + * The task may have entered a memcg OOM situation but + * if the allocation error was handled gracefully (no + * VM_FAULT_OOM), there is no need to kill anything. + * Just clean up the OOM state peacefully. + */ if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) mem_cgroup_oom_synchronize(false); } -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751307AbdBAXiX (ORCPT ); Wed, 1 Feb 2017 18:38:23 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:51785 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066AbdBAXiR (ORCPT ); Wed, 1 Feb 2017 18:38:17 -0500 X-ME-Sender: X-Sasl-enc: q5O7LMp05T6NlgI4o/tA5V3S2g4mA/4jjgb7gPzDe6D+ 1485992285 From: "Tobin C. Harding" To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko , Tobin C Harding Subject: [PATCH 4/4] mm: Fix checkpatch warning, extraneous braces Date: Thu, 2 Feb 2017 10:37:20 +1100 Message-Id: <1485992240-10986-5-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485992240-10986-1-git-send-email-me@tobin.cc> References: <1485992240-10986-1-git-send-email-me@tobin.cc> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tobin C Harding Patch fixes checkpatch warning on use of braces around a single statement. Signed-off-by: Tobin C Harding --- mm/memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 35fb8b2..654e6f4 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1128,9 +1128,8 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, arch_enter_lazy_mmu_mode(); do { pte_t ptent = *pte; - if (pte_none(ptent)) { + if (pte_none(ptent)) continue; - } if (pte_present(ptent)) { struct page *page; -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751155AbdBAXiC (ORCPT ); Wed, 1 Feb 2017 18:38:02 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:56492 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066AbdBAXiA (ORCPT ); Wed, 1 Feb 2017 18:38:00 -0500 X-ME-Sender: X-Sasl-enc: YLFuHz1F2YGtqp0HQfllHHk7axLKUfLJFQ2GL4f+9m77 1485992279 From: "Tobin C. Harding" To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko , Tobin C Harding Subject: [PATCH 2/4] mm: Fix checkpatch warnings, whitespace Date: Thu, 2 Feb 2017 10:37:18 +1100 Message-Id: <1485992240-10986-3-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485992240-10986-1-git-send-email-me@tobin.cc> References: <1485992240-10986-1-git-send-email-me@tobin.cc> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tobin C Harding Patch fixes whitespace checkpatch warnings. Signed-off-by: Tobin C Harding --- mm/memory.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index cc5fa12..3562314 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -30,7 +30,7 @@ /* * 05.04.94 - Multi-page memory management added for v1.1. - * Idea by Alex Bligh (alex@cconcepts.co.uk) + * Idea by Alex Bligh (alex@cconcepts.co.uk) * * 16.07.99 - Support of BIGMEM added by Gerhard Wichert, Siemens AG * (Gerhard.Wichert@pdb.siemens.de) @@ -82,9 +82,9 @@ #ifndef CONFIG_NEED_MULTIPLE_NODES /* use the per-pgdat data instead for discontigmem - mbligh */ unsigned long max_mapnr; -struct page *mem_map; - EXPORT_SYMBOL(max_mapnr); + +struct page *mem_map; EXPORT_SYMBOL(mem_map); #endif @@ -96,7 +96,6 @@ EXPORT_SYMBOL(mem_map); * and ZONE_HIGHMEM. */ void * high_memory; - EXPORT_SYMBOL(high_memory); /* @@ -120,10 +119,10 @@ static int __init disable_randmaps(char *s) __setup("norandmaps", disable_randmaps); unsigned long zero_pfn __read_mostly; -unsigned long highest_memmap_pfn __read_mostly; - EXPORT_SYMBOL(zero_pfn); +unsigned long highest_memmap_pfn __read_mostly; + /* * CONFIG_MMU architectures set up ZERO_PAGE in their paging_init() */ @@ -3696,8 +3695,8 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, * VM_FAULT_OOM), there is no need to kill anything. * Just clean up the OOM state peacefully. */ - if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) - mem_cgroup_oom_synchronize(false); + if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) + mem_cgroup_oom_synchronize(false); } /* -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751360AbdBBAsc (ORCPT ); Wed, 1 Feb 2017 19:48:32 -0500 Received: from mail-pg0-f44.google.com ([74.125.83.44]:36049 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750832AbdBBAsb (ORCPT ); Wed, 1 Feb 2017 19:48:31 -0500 Date: Wed, 1 Feb 2017 16:48:28 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: "Tobin C. Harding" cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko Subject: Re: [PATCH 2/4] mm: Fix checkpatch warnings, whitespace In-Reply-To: <1485992240-10986-3-git-send-email-me@tobin.cc> Message-ID: References: <1485992240-10986-1-git-send-email-me@tobin.cc> <1485992240-10986-3-git-send-email-me@tobin.cc> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2 Feb 2017, Tobin C. Harding wrote: > @@ -3696,8 +3695,8 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, > * VM_FAULT_OOM), there is no need to kill anything. > * Just clean up the OOM state peacefully. > */ > - if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) > - mem_cgroup_oom_synchronize(false); > + if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) > + mem_cgroup_oom_synchronize(false); > } > > /* The comment suffers from the same problem. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750891AbdBBDvY (ORCPT ); Wed, 1 Feb 2017 22:51:24 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:49777 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbdBBDvW (ORCPT ); Wed, 1 Feb 2017 22:51:22 -0500 X-ME-Sender: X-Sasl-enc: VC6kVj6imJVIPbMTIx3xZ/IXQBK6gbnmxduLBxm40fIx 1486007481 Date: Thu, 2 Feb 2017 14:51:17 +1100 From: Tobin Harding To: David Rientjes Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko Subject: Re: [PATCH 2/4] mm: Fix checkpatch warnings, whitespace Message-ID: <20170202035117.GA15650@eros> References: <1485992240-10986-1-git-send-email-me@tobin.cc> <1485992240-10986-3-git-send-email-me@tobin.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailer: Mutt 1.5.24 (2015-08-30) User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 01, 2017 at 04:48:28PM -0800, David Rientjes wrote: > On Thu, 2 Feb 2017, Tobin C. Harding wrote: > > > @@ -3696,8 +3695,8 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, > > * VM_FAULT_OOM), there is no need to kill anything. > > * Just clean up the OOM state peacefully. > > */ > > - if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) > > - mem_cgroup_oom_synchronize(false); > > + if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM)) > > + mem_cgroup_oom_synchronize(false); > > } > > > > /* > > The comment suffers from the same problem. The comment is fixed in the next patch of the set. The fixes are in separate patches because one was a checkpatch warning and one was an error. Any comments on the structure of the patchset most appreciated. thanks, Tobin. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751043AbdBBNI3 (ORCPT ); Thu, 2 Feb 2017 08:08:29 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35594 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbdBBNI2 (ORCPT ); Thu, 2 Feb 2017 08:08:28 -0500 Date: Thu, 2 Feb 2017 16:08:25 +0300 From: "Kirill A. Shutemov" To: "Tobin C. Harding" Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Jan Kara , Ross Zwisler , Michal Hocko Subject: Re: [PATCH 1/4] mm: Fix sparse, use plain integer as NULL pointer Message-ID: <20170202130825.GA32180@node> References: <1485992240-10986-1-git-send-email-me@tobin.cc> <1485992240-10986-2-git-send-email-me@tobin.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1485992240-10986-2-git-send-email-me@tobin.cc> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 02, 2017 at 10:37:17AM +1100, Tobin C. Harding wrote: > From: Tobin C Harding > > Patch fixes sparse warning: Using plain integer as NULL pointer. Replaces > assignment of 0 to pointer with NULL assignment. > > Signed-off-by: Tobin C Harding I wrote this part when ARC had pgtable_t defined as 'unsigned long', so NULL wasn't an option, but 0 was as it's valid pointer according to spec. Acked-by: Kirill A. Shutemov -- Kirill A. Shutemov