mm: trivial sparse and checkpatch fixes
Subsystems (2)
cover mm: trivial sparse and checkpatch fixes
From: Tobin C Harding <[email protected]>
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(-)
Signature · 7 lines
2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/4 mm: Fix sparse, use plain integer as NULL pointer
From: Tobin C Harding <[email protected]>
Patch fixes sparse warning: Using plain integer as NULL pointer. Replaces assignment of 0 to pointer with NULL assignment.
--- mm/memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/memory.c +3 -3
@@ -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; }
Signature · 7 lines
2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/4] mm: Fix sparse, use plain integer as NULL pointer
Quoted 6 lines · Tobin C. Harding
From: Tobin C Harding <[email protected]>
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 <[email protected]>
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.
Signature · 7 lines
Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/4 mm: Fix checkpatch warnings, whitespace
In reply to Tobin C. HardingFrom: Tobin C Harding <[email protected]>
Patch fixes whitespace checkpatch warnings.
--- mm/memory.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
mm/memory.c +7 -8
@@ -30,7 +30,7 @@/* * 05.04.94 - Multi-page memory management added for v1.1. -* Idea by Alex Bligh ([email protected]) +* Idea by Alex Bligh ([email protected]) * * 16.07.99 - Support of BIGMEM added by Gerhard Wichert, Siemens AG * ([email protected])
@@ -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); }/*
Signature · 7 lines
2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/4] mm: Fix checkpatch warnings, whitespace
mm/memory.c int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, · line 3702
Quoted 11 lines · Tobin C. Harding
mm/memory.c +2
-2@@ -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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/4] mm: Fix checkpatch warnings, whitespace
Quoted 12 lines · David Rientjes
Quoted 10 lines · Tobin C. Harding
mm/memory.c +2
-2@@ -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); }
Quoted 3 lines
Review int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, · line 3702
Quoted 1 line
(quoted diff) +0
-0/*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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/4 mm: Fix checkpatch errors, whitespace errors
In reply to Tobin C. HardingFrom: Tobin C Harding <[email protected]>
Patch fixes whitespace checkpatch errors.
--- mm/memory.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
mm/memory.c +21 -21
@@ -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); }
Signature · 7 lines
2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/4 mm: Fix checkpatch warning, extraneous braces
In reply to Tobin C. HardingFrom: Tobin C Harding <[email protected]>
Patch fixes checkpatch warning on use of braces around a single statement.
--- mm/memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
mm/memory.c +1 -2
@@ -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;
Signature · 7 lines
2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>