[PATCH] mm/filemap: minor coding style tweaks

2021-02-24 Thread Zhiyuan Dai
Delete whitespace to fix coding style issues, improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/filemap.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 6ff2a3f..20f27b6 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3111,7 +3111,7 @@ vm_fault_t filemap_page_mkwrite(struct vm_fault *vmf)
 
 /* This is used for a general mmap of a disk file */
 
-int generic_file_mmap(struct file * file, struct vm_area_struct * vma)
+int generic_file_mmap(struct file *file, struct vm_area_struct *vma)
 {
struct address_space *mapping = file->f_mapping;
 
@@ -3136,11 +3136,11 @@ vm_fault_t filemap_page_mkwrite(struct vm_fault *vmf)
 {
return VM_FAULT_SIGBUS;
 }
-int generic_file_mmap(struct file * file, struct vm_area_struct * vma)
+int generic_file_mmap(struct file *file, struct vm_area_struct *vma)
 {
return -ENOSYS;
 }
-int generic_file_readonly_mmap(struct file * file, struct vm_area_struct * vma)
+int generic_file_readonly_mmap(struct file *file, struct vm_area_struct *vma)
 {
return -ENOSYS;
 }
@@ -3567,7 +3567,7 @@ ssize_t generic_perform_write(struct file *file,
 ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 {
struct file *file = iocb->ki_filp;
-   struct address_space * mapping = file->f_mapping;
+   struct address_space *mapping = file->f_mapping;
struct inode*inode = mapping->host;
ssize_t written = 0;
ssize_t err;
-- 
1.8.3.1



[PATCH] mm/page_alloc: minor coding style tweaks

2021-02-24 Thread Zhiyuan Dai
Add whitespace to fix coding style issues, improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ef5070f..c7c4991 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8603,7 +8603,7 @@ int alloc_contig_range(unsigned long start, unsigned long 
end,
ret = __alloc_contig_migrate_range(, start, end);
if (ret && ret != -EBUSY)
goto done;
-   ret =0;
+   ret = 0;
 
/*
 * Pages from [start, end) are within a MAX_ORDER_NR_PAGES
-- 
1.8.3.1



[PATCH] mm/shmem: minor coding style tweaks

2021-02-24 Thread Zhiyuan Dai
Add whitespace to fix coding style issues, improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 1b254fb..e5fb90c 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3559,7 +3559,7 @@ static int shmem_parse_options(struct fs_context *fc, 
void *data)
}
}
if (*this_char) {
-   char *value = strchr(this_char,'=');
+   char *value = strchr(this_char, '=');
size_t len = 0;
int err;
 
-- 
1.8.3.1



[PATCH] mm/oom_kill: minor coding style tweaks

2021-02-24 Thread Zhiyuan Dai
Add whitespace to fix coding style issues, improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/oom_kill.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index c9a33ff..dd12dad7 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -994,7 +994,7 @@ static void oom_kill_process(struct oom_control *oc, const 
char *message)
if (oom_group) {
mem_cgroup_print_oom_group(oom_group);
mem_cgroup_scan_tasks(oom_group, oom_kill_memcg_member,
- (void*)message);
+ (void *)message);
mem_cgroup_put(oom_group);
}
 }
-- 
1.8.3.1



[PATCH] mm/compaction: minor coding style tweaks

2021-02-24 Thread Zhiyuan Dai
Add whitespace to fix coding style issues, improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/compaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 190ccda..bd821e1 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -2837,7 +2837,7 @@ void wakeup_kcompactd(pg_data_t *pgdat, int order, int 
highest_zoneidx)
  */
 static int kcompactd(void *p)
 {
-   pg_data_t *pgdat = (pg_data_t*)p;
+   pg_data_t *pgdat = (pg_data_t *)p;
struct task_struct *tsk = current;
unsigned int proactive_defer = 0;
 
-- 
1.8.3.1



[PATCH] mm/zswap: switch from strlcpy to strscpy

2021-02-24 Thread Zhiyuan Dai
strlcpy is marked as deprecated in Documentation/process/deprecated.rst,
and there is no functional difference when the caller expects truncation
(when not checking the return value). strscpy is relatively better as it
also avoids scanning the whole source string.

Signed-off-by: Zhiyuan Dai 
---
 mm/zswap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/zswap.c b/mm/zswap.c
index 182f6ad..3a92d0b 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -614,7 +614,7 @@ static struct zswap_pool *zswap_pool_create(char *type, 
char *compressor)
}
pr_debug("using %s zpool\n", zpool_get_type(pool->zpool));
 
-   strlcpy(pool->tfm_name, compressor, sizeof(pool->tfm_name));
+   strscpy(pool->tfm_name, compressor, sizeof(pool->tfm_name));
 
pool->acomp_ctx = alloc_percpu(*pool->acomp_ctx);
if (!pool->acomp_ctx) {
-- 
1.8.3.1



[PATCH] mm/vmscan: minor coding style tweaks

2021-02-24 Thread Zhiyuan Dai
Add whitespace to fix coding style issues, improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index b1b574a..333c43b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3872,7 +3872,7 @@ static int kswapd(void *p)
 {
unsigned int alloc_order, reclaim_order;
unsigned int highest_zoneidx = MAX_NR_ZONES - 1;
-   pg_data_t *pgdat = (pg_data_t*)p;
+   pg_data_t *pgdat = (pg_data_t *)p;
struct task_struct *tsk = current;
const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id);
 
-- 
1.8.3.1



[PATCH] mm/sparse: minor coding style tweaks

2021-02-24 Thread Zhiyuan Dai
Add whitespace to fix coding style issues, improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/sparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 7bd23f9..be66a62 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -257,7 +257,7 @@ static void __init memory_present(int nid, unsigned long 
start, unsigned long en
if (unlikely(!mem_section)) {
unsigned long size, align;
 
-   size = sizeof(struct mem_section*) * NR_SECTION_ROOTS;
+   size = sizeof(struct mem_section *) * NR_SECTION_ROOTS;
align = 1 << (INTERNODE_CACHE_SHIFT);
mem_section = memblock_alloc(size, align);
if (!mem_section)
-- 
1.8.3.1



[PATCH] mm/swapfile: minor coding style tweaks

2021-02-24 Thread Zhiyuan Dai
Add whitespace to fix coding style issues, improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/swapfile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 96799a2..d261be4 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2767,7 +2767,7 @@ static int swap_show(struct seq_file *swap, void *v)
unsigned int bytes, inuse;
 
if (si == SEQ_START_TOKEN) {
-   
seq_puts(swap,"Filename\t\t\t\tType\t\tSize\t\tUsed\t\tPriority\n");
+   seq_puts(swap, 
"Filename\t\t\t\tType\t\tSize\t\tUsed\t\tPriority\n");
return 0;
}
 
@@ -3271,7 +3271,7 @@ static bool swap_discardable(struct swap_info_struct *si)
 sizeof(long),
 GFP_KERNEL);
 
-   if (p->bdev &&(swap_flags & SWAP_FLAG_DISCARD) && swap_discardable(p)) {
+   if (p->bdev && (swap_flags & SWAP_FLAG_DISCARD) && swap_discardable(p)) 
{
/*
 * When discard is enabled for swap with no particular
 * policy flagged, we set all swap discard flags here in
-- 
1.8.3.1



[PATCH] mm/memremap: Fixes improper SPDX comment style

2021-02-24 Thread Zhiyuan Dai
Replace /* */ comment with //, fix SPDX comment style.

see: Documentation/process/license-rules.rst

Signed-off-by: Zhiyuan Dai 
---
 mm/memremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memremap.c b/mm/memremap.c
index 16b2fb4..ffafac0 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+// SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2015 Intel Corporation. All rights reserved. */
 #include 
 #include 
-- 
1.8.3.1



[PATCH] mm/mempool: minor coding style tweaks

2021-02-24 Thread Zhiyuan Dai
Add whitespace to fix coding style issues, improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/mempool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mempool.c b/mm/mempool.c
index 624ed51..fbf0513 100644
--- a/mm/mempool.c
+++ b/mm/mempool.c
@@ -251,7 +251,7 @@ int mempool_init(mempool_t *pool, int min_nr, 
mempool_alloc_t *alloc_fn,
 mempool_t *mempool_create(int min_nr, mempool_alloc_t *alloc_fn,
mempool_free_t *free_fn, void *pool_data)
 {
-   return mempool_create_node(min_nr,alloc_fn,free_fn, pool_data,
+   return mempool_create_node(min_nr, alloc_fn, free_fn, pool_data,
   GFP_KERNEL, NUMA_NO_NODE);
 }
 EXPORT_SYMBOL(mempool_create);
-- 
1.8.3.1



[PATCH] mm/mempolicy: minor coding style tweaks

2021-02-21 Thread Zhiyuan Dai
Add whitespace to fix coding style issues, improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/mempolicy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 2c3a865..740633d 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -330,7 +330,7 @@ static void mpol_rebind_nodemask(struct mempolicy *pol, 
const nodemask_t *nodes)
else if (pol->flags & MPOL_F_RELATIVE_NODES)
mpol_relative_nodemask(, >w.user_nodemask, nodes);
else {
-   nodes_remap(tmp, pol->v.nodes,pol->w.cpuset_mems_allowed,
+   nodes_remap(tmp, pol->v.nodes, pol->w.cpuset_mems_allowed,
*nodes);
pol->w.cpuset_mems_allowed = *nodes;
}
@@ -1151,7 +1151,7 @@ int do_migrate_pages(struct mm_struct *mm, const 
nodemask_t *from,
 
tmp = *from;
while (!nodes_empty(tmp)) {
-   int s,d;
+   int s, d;
int source = NUMA_NO_NODE;
int dest = 0;
 
-- 
1.8.3.1



[PATCH] mm/memory_hotplug: minor coding style tweaks

2021-02-21 Thread Zhiyuan Dai
This patch move the pointer location to fix coding style issues,
improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/memory_hotplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index f9d57b9..a46c297 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -764,7 +764,7 @@ static inline struct zone *default_zone_for_pfn(int nid, 
unsigned long start_pfn
return movable_node_enabled ? movable_zone : kernel_zone;
 }
 
-struct zone * zone_for_pfn_range(int online_type, int nid, unsigned start_pfn,
+struct zone *zone_for_pfn_range(int online_type, int nid, unsigned start_pfn,
unsigned long nr_pages)
 {
if (online_type == MMOP_ONLINE_KERNEL)
-- 
1.8.3.1



[PATCH] mm/kasan: remove volatile keyword

2021-02-21 Thread Zhiyuan Dai
Like volatile, the kernel primitives which make concurrent
access to data safe (spinlocks, mutexes, memory barriers,
etc.) are designed to prevent unwanted optimization.

If they are being used properly, there will be no need to
use volatile as well.  If volatile is still necessary,
there is almost certainly a bug in the code somewhere.
In properly-written kernel code, volatile can only serve
to slow things down.

see: Documentation/process/volatile-considered-harmful.rst

Signed-off-by: Zhiyuan Dai 
---
 mm/kasan/shadow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c
index 7c2c08c..d5ff9ca 100644
--- a/mm/kasan/shadow.c
+++ b/mm/kasan/shadow.c
@@ -25,13 +25,13 @@
 
 #include "kasan.h"
 
-bool __kasan_check_read(const volatile void *p, unsigned int size)
+bool __kasan_check_read(const void *p, unsigned int size)
 {
return check_memory_region((unsigned long)p, size, false, _RET_IP_);
 }
 EXPORT_SYMBOL(__kasan_check_read);
 
-bool __kasan_check_write(const volatile void *p, unsigned int size)
+bool __kasan_check_write(const void *p, unsigned int size)
 {
return check_memory_region((unsigned long)p, size, true, _RET_IP_);
 }
-- 
1.8.3.1



[PATCH] mm/kasan: switch from strlcpy to strscpy

2021-02-21 Thread Zhiyuan Dai
strlcpy is marked as deprecated in Documentation/process/deprecated.rst,
and there is no functional difference when the caller expects truncation
(when not checking the return value). strscpy is relatively better as it
also avoids scanning the whole source string.

Signed-off-by: Zhiyuan Dai 
---
 mm/kasan/report_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/kasan/report_generic.c b/mm/kasan/report_generic.c
index 8a9c889..fc7f7ad 100644
--- a/mm/kasan/report_generic.c
+++ b/mm/kasan/report_generic.c
@@ -148,7 +148,7 @@ static bool __must_check tokenize_frame_descr(const char 
**frame_descr,
}
 
/* Copy token (+ 1 byte for '\0'). */
-   strlcpy(token, *frame_descr, tok_len + 1);
+   strscpy(token, *frame_descr, tok_len + 1);
}
 
/* Advance frame_descr past separator. */
-- 
1.8.3.1



[PATCH] mm/ioremap: remove volatile keyword in iounmap function

2021-02-21 Thread Zhiyuan Dai
Like volatile, the kernel primitives which make concurrent
access to data safe (spinlocks, mutexes, memory barriers,
etc.) are designed to prevent unwanted optimization.

If they are being used properly, there will be no need to
use volatile as well.  If volatile is still necessary,
there is almost certainly a bug in the code somewhere.
In properly-written kernel code, volatile can only serve
to slow things down.

see: Documentation/process/volatile-considered-harmful.rst

Signed-off-by: Zhiyuan Dai 
---
 mm/ioremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/ioremap.c b/mm/ioremap.c
index 5fa1ab4..c49dd41 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -281,7 +281,7 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, 
unsigned long prot)
 }
 EXPORT_SYMBOL(ioremap_prot);
 
-void iounmap(volatile void __iomem *addr)
+void iounmap(void __iomem *addr)
 {
vunmap((void *)((unsigned long)addr & PAGE_MASK));
 }
-- 
1.8.3.1



[PATCH] mm/interval_tree: add comments to improve code reading

2021-02-21 Thread Zhiyuan Dai
Add a comment explain the value of the ISSTATIC parameter,
Inform the reader that this is not a coding style issue.

Signed-off-by: Zhiyuan Dai 
---
 mm/interval_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/interval_tree.c b/mm/interval_tree.c
index 11c75fb..32e390c 100644
--- a/mm/interval_tree.c
+++ b/mm/interval_tree.c
@@ -22,7 +22,7 @@ static inline unsigned long vma_last_pgoff(struct 
vm_area_struct *v)
 
 INTERVAL_TREE_DEFINE(struct vm_area_struct, shared.rb,
 unsigned long, shared.rb_subtree_last,
-vma_start_pgoff, vma_last_pgoff,, vma_interval_tree)
+vma_start_pgoff, vma_last_pgoff, /* empty */, 
vma_interval_tree)
 
 /* Insert node immediately after prev in the interval tree */
 void vma_interval_tree_insert_after(struct vm_area_struct *node,
-- 
1.8.3.1



[PATCH] mm/vmalloc: minor coding style tweaks

2021-02-21 Thread Zhiyuan Dai
Macros with complex values should be enclosed in parentheses.

Signed-off-by: Zhiyuan Dai 
---
 mm/vmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 4f5f8c9..82cfa39 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2739,7 +2739,7 @@ void *vzalloc_node(unsigned long size, int node)
  * 64b systems should always have either DMA or DMA32 zones. For others
  * GFP_DMA32 should do the right thing and use the normal zone.
  */
-#define GFP_VMALLOC32 GFP_DMA32 | GFP_KERNEL
+#define GFP_VMALLOC32 (GFP_DMA32 | GFP_KERNEL)
 #endif
 
 /**
-- 
1.8.3.1



[PATCH] mm/frontswap: minor coding style tweaks

2021-02-21 Thread Zhiyuan Dai
This patch move brace position to fix coding style issues,
improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/frontswap.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/mm/frontswap.c b/mm/frontswap.c
index 2183a56..ea6a3b4 100644
--- a/mm/frontswap.c
+++ b/mm/frontswap.c
@@ -60,16 +60,20 @@
 static u64 frontswap_failed_stores;
 static u64 frontswap_invalidates;
 
-static inline void inc_frontswap_loads(void) {
+static inline void inc_frontswap_loads(void) 
+{
data_race(frontswap_loads++);
 }
-static inline void inc_frontswap_succ_stores(void) {
+static inline void inc_frontswap_succ_stores(void) 
+{
data_race(frontswap_succ_stores++);
 }
-static inline void inc_frontswap_failed_stores(void) {
+static inline void inc_frontswap_failed_stores(void) 
+{
data_race(frontswap_failed_stores++);
 }
-static inline void inc_frontswap_invalidates(void) {
+static inline void inc_frontswap_invalidates(void) 
+{
data_race(frontswap_invalidates++);
 }
 #else
-- 
1.8.3.1



[PATCH] mm/dmapool: switch from strlcpy to strscpy

2021-02-21 Thread Zhiyuan Dai
strlcpy is marked as deprecated in Documentation/process/deprecated.rst,
and there is no functional difference when the caller expects truncation
(when not checking the return value). strscpy is relatively better as it
also avoids scanning the whole source string.

Signed-off-by: Zhiyuan Dai 
---
 mm/dmapool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/dmapool.c b/mm/dmapool.c
index a97c972..38cf2a7 100644
--- a/mm/dmapool.c
+++ b/mm/dmapool.c
@@ -156,7 +156,7 @@ struct dma_pool *dma_pool_create(const char *name, struct 
device *dev,
if (!retval)
return retval;
 
-   strlcpy(retval->name, name, sizeof(retval->name));
+   strscpy(retval->name, name, sizeof(retval->name));
 
retval->dev = dev;
 
-- 
1.8.3.1



[PATCH] arm64/mm: Fixed some coding style issues

2021-02-21 Thread Zhiyuan Dai
This patch move the pointer location to fix coding style issues,
improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 arch/arm64/mm/mmu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 25af183..9ce8641 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -1155,7 +1155,7 @@ void vmemmap_free(unsigned long start, unsigned long end,
 }
 #endif /* CONFIG_SPARSEMEM_VMEMMAP */
 
-static inline pud_t * fixmap_pud(unsigned long addr)
+static inline pud_t *fixmap_pud(unsigned long addr)
 {
pgd_t *pgdp = pgd_offset_k(addr);
p4d_t *p4dp = p4d_offset(pgdp, addr);
@@ -1166,7 +1166,7 @@ static inline pud_t * fixmap_pud(unsigned long addr)
return pud_offset_kimg(p4dp, addr);
 }
 
-static inline pmd_t * fixmap_pmd(unsigned long addr)
+static inline pmd_t *fixmap_pmd(unsigned long addr)
 {
pud_t *pudp = fixmap_pud(addr);
pud_t pud = READ_ONCE(*pudp);
@@ -1176,7 +1176,7 @@ static inline pmd_t * fixmap_pmd(unsigned long addr)
return pmd_offset_kimg(pudp, addr);
 }
 
-static inline pte_t * fixmap_pte(unsigned long addr)
+static inline pte_t *fixmap_pte(unsigned long addr)
 {
return _pte[pte_index(addr)];
 }
-- 
1.8.3.1



[PATCH] mm/mlock: minor coding style tweaks

2021-02-21 Thread Zhiyuan Dai
This patch move the pointer location to fix coding style issues,
improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/mlock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mlock.c b/mm/mlock.c
index 55b3b36..f6e26c2 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -560,7 +560,7 @@ static int apply_vma_lock_flags(unsigned long start, size_t 
len,
vm_flags_t flags)
 {
unsigned long nstart, end, tmp;
-   struct vm_area_struct * vma, * prev;
+   struct vm_area_struct *vma, *prev;
int error;
 
VM_BUG_ON(offset_in_page(start));
@@ -738,7 +738,7 @@ static __must_check int do_mlock(unsigned long start, 
size_t len, vm_flags_t fla
  */
 static int apply_mlockall_flags(int flags)
 {
-   struct vm_area_struct * vma, * prev = NULL;
+   struct vm_area_struct *vma, *prev = NULL;
vm_flags_t to_add = 0;
 
current->mm->def_flags &= VM_LOCKED_CLEAR_MASK;
-- 
1.8.3.1



[PATCH] mm/mlock: minor coding style tweaks

2021-02-08 Thread Zhiyuan Dai
This patch move the pointer location to fix coding style issues,
improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/mlock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mlock.c b/mm/mlock.c
index 55b3b36..f6e26c2 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -560,7 +560,7 @@ static int apply_vma_lock_flags(unsigned long start, size_t 
len,
vm_flags_t flags)
 {
unsigned long nstart, end, tmp;
-   struct vm_area_struct * vma, * prev;
+   struct vm_area_struct *vma, *prev;
int error;
 
VM_BUG_ON(offset_in_page(start));
@@ -738,7 +738,7 @@ static __must_check int do_mlock(unsigned long start, 
size_t len, vm_flags_t fla
  */
 static int apply_mlockall_flags(int flags)
 {
-   struct vm_area_struct * vma, * prev = NULL;
+   struct vm_area_struct *vma, *prev = NULL;
vm_flags_t to_add = 0;
 
current->mm->def_flags &= VM_LOCKED_CLEAR_MASK;
-- 
1.8.3.1



[PATCH] mm/slub: minor coding style tweaks

2021-02-08 Thread Zhiyuan Dai
This patch adds whitespace to fix coding style issues,
improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 mm/slub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index 7ecbbbe..3313897 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3266,7 +3266,7 @@ void kmem_cache_free_bulk(struct kmem_cache *s, size_t 
size, void **p)
if (!df.page)
continue;
 
-   slab_free(df.s, df.page, df.freelist, df.tail, df.cnt,_RET_IP_);
+   slab_free(df.s, df.page, df.freelist, df.tail, df.cnt, 
_RET_IP_);
} while (likely(size));
 }
 EXPORT_SYMBOL(kmem_cache_free_bulk);
-- 
1.8.3.1



[PATCH] mm/slab: minor coding style tweaks

2021-02-08 Thread Zhiyuan Dai
Fixed some coding style issues, improve code reading.
This patch adds whitespace to clearly separate the parameters.

Signed-off-by: Zhiyuan Dai 
---
 mm/slab.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index d7c8da9..30bba30 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -272,7 +272,7 @@ static void kmem_cache_node_init(struct kmem_cache_node 
*parent)
 #defineSTATS_DEC_ACTIVE(x) ((x)->num_active--)
 #defineSTATS_INC_ALLOCED(x)((x)->num_allocations++)
 #defineSTATS_INC_GROWN(x)  ((x)->grown++)
-#defineSTATS_ADD_REAPED(x,y)   ((x)->reaped += (y))
+#defineSTATS_ADD_REAPED(x, y)  ((x)->reaped += (y))
 #defineSTATS_SET_HIGH(x)   
\
do {\
if ((x)->num_active > (x)->high_mark)   \
@@ -296,7 +296,7 @@ static void kmem_cache_node_init(struct kmem_cache_node 
*parent)
 #defineSTATS_DEC_ACTIVE(x) do { } while (0)
 #defineSTATS_INC_ALLOCED(x)do { } while (0)
 #defineSTATS_INC_GROWN(x)  do { } while (0)
-#defineSTATS_ADD_REAPED(x,y)   do { (void)(y); } while (0)
+#defineSTATS_ADD_REAPED(x, y)  do { (void)(y); } while (0)
 #defineSTATS_SET_HIGH(x)   do { } while (0)
 #defineSTATS_INC_ERR(x)do { } while (0)
 #defineSTATS_INC_NODEALLOCS(x) do { } while (0)
@@ -332,7 +332,7 @@ static int obj_offset(struct kmem_cache *cachep)
 static unsigned long long *dbg_redzone1(struct kmem_cache *cachep, void *objp)
 {
BUG_ON(!(cachep->flags & SLAB_RED_ZONE));
-   return (unsigned long long*) (objp + obj_offset(cachep) -
+   return (unsigned long long *) (objp + obj_offset(cachep) -
  sizeof(unsigned long long));
 }
 
@@ -580,7 +580,7 @@ static int transfer_objects(struct array_cache *to,
if (!nr)
return 0;
 
-   memcpy(to->entry + to->avail, from->entry + from->avail -nr,
+   memcpy(to->entry + to->avail, from->entry + from->avail - nr,
sizeof(void *) *nr);
 
from->avail -= nr;
@@ -2738,7 +2738,7 @@ static void *cache_free_debugcheck(struct kmem_cache 
*cachep, void *objp,
 
 #else
 #define kfree_debugcheck(x) do { } while(0)
-#define cache_free_debugcheck(x,objp,z) (objp)
+#define cache_free_debugcheck(x, objp, z) (objp)
 #endif
 
 static inline void fixup_objfreelist_debug(struct kmem_cache *cachep,
@@ -3025,7 +3025,7 @@ static void *cache_alloc_debugcheck_after(struct 
kmem_cache *cachep,
return objp;
 }
 #else
-#define cache_alloc_debugcheck_after(a,b,objp,d) (objp)
+#define cache_alloc_debugcheck_after(a, b, objp, d) (objp)
 #endif
 
 static inline void *cache_alloc(struct kmem_cache *cachep, gfp_t flags)
-- 
1.8.3.1



[PATCH] ceph: minor coding style tweaks

2021-02-03 Thread Zhiyuan Dai
Fixed some coding style issues, improve code reading.
1. Move the pointer location
2. Move brace position
3. Alignment to open parenthesis

This patch adds whitespace to clearly separate the parameters.

Signed-off-by: Zhiyuan Dai 
---
 fs/ceph/addr.c   |  3 +--
 fs/ceph/cache.c  | 14 +++---
 fs/ceph/caps.c   |  2 +-
 fs/ceph/dir.c|  6 +++---
 fs/ceph/export.c |  2 +-
 fs/ceph/inode.c  |  6 +++---
 fs/ceph/locks.c  |  2 +-
 fs/ceph/mds_client.c |  8 
 fs/ceph/mdsmap.c |  4 ++--
 fs/ceph/snap.c   |  6 +++---
 fs/ceph/xattr.c  |  4 ++--
 11 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 9505529..94ce73e 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -493,8 +493,7 @@ static int ceph_readpages(struct file *file, struct 
address_space *mapping,
return rc;
 }
 
-struct ceph_writeback_ctl
-{
+struct ceph_writeback_ctl {
loff_t i_size;
u64 truncate_size;
u32 truncate_seq;
diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c
index 2f5cb6b..795523e 100644
--- a/fs/ceph/cache.c
+++ b/fs/ceph/cache.c
@@ -50,7 +50,7 @@ void ceph_fscache_unregister(void)
fscache_unregister_netfs(_cache_netfs);
 }
 
-int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc)
+int ceph_fscache_register_fs(struct ceph_fs_client *fsc, struct fs_context *fc)
 {
const struct ceph_fsid *fsid = >client->fsid;
const char *fscache_uniq = fsc->mount_options->fscache_uniq;
@@ -110,8 +110,8 @@ static enum fscache_checkaux ceph_fscache_inode_check_aux(
loff_t object_size)
 {
struct ceph_aux_inode aux;
-   struct ceph_inode_info* ci = cookie_netfs_data;
-   struct inode* inode = >vfs_inode;
+   struct ceph_inode_info *ci = cookie_netfs_data;
+   struct inode *inode = >vfs_inode;
 
if (dlen != sizeof(aux) ||
i_size_read(inode) != object_size)
@@ -164,9 +164,9 @@ void ceph_fscache_register_inode_cookie(struct inode *inode)
inode_unlock(inode);
 }
 
-void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info* ci)
+void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info *ci)
 {
-   struct fscache_cookie* cookie;
+   struct fscache_cookie *cookie;
 
if ((cookie = ci->fscache) == NULL)
return;
@@ -296,7 +296,7 @@ void ceph_readpage_to_fscache(struct inode *inode, struct 
page *page)
 fscache_uncache_page(ci->fscache, page);
 }
 
-void ceph_invalidate_fscache_page(struct inode* inode, struct page *page)
+void ceph_invalidate_fscache_page(struct inode *inode, struct page *page)
 {
struct ceph_inode_info *ci = ceph_inode(inode);
 
@@ -307,7 +307,7 @@ void ceph_invalidate_fscache_page(struct inode* inode, 
struct page *page)
fscache_uncache_page(ci->fscache, page);
 }
 
-void ceph_fscache_unregister_fs(struct ceph_fs_client* fsc)
+void ceph_fscache_unregister_fs(struct ceph_fs_client *fsc)
 {
if (fscache_cookie_valid(fsc->fscache)) {
struct ceph_fscache_entry *ent;
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 255a512..39fe5d8 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2270,7 +2270,7 @@ static int caps_are_flushed(struct inode *inode, u64 
flush_tid)
 
spin_lock(>i_ceph_lock);
if (!list_empty(>i_cap_flush_list)) {
-   struct ceph_cap_flush * cf =
+   struct ceph_cap_flush *cf =
list_first_entry(>i_cap_flush_list,
 struct ceph_cap_flush, i_list);
if (cf->tid <= flush_tid)
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 858ee73..2b7edd00 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1269,7 +1269,7 @@ void __ceph_dentry_lease_touch(struct ceph_dentry_info 
*di)
spin_unlock(>dentry_list_lock);
 }
 
-static void __dentry_dir_lease_touch(struct ceph_mds_client* mdsc,
+static void __dentry_dir_lease_touch(struct ceph_mds_client *mdsc,
 struct ceph_dentry_info *di)
 {
di->flags &= ~(CEPH_DENTRY_LEASE_LIST | CEPH_DENTRY_REFERENCED);
@@ -1351,7 +1351,7 @@ struct ceph_lease_walk_control {
 {
struct ceph_dentry_info *di, *tmp;
struct dentry *dentry, *last = NULL;
-   struct list_head* list;
+   struct list_head *list;
 LIST_HEAD(dispose);
unsigned long freed = 0;
int ret = 0;
@@ -1498,7 +1498,7 @@ int ceph_trim_dentries(struct ceph_mds_client *mdsc)
lwc.dir_lease = true;
lwc.expire_dir_lease = freed < count;
lwc.dir_lease_ttl = mdsc->fsc->mount_options->caps_wanted_delay_max * 
HZ;
-   freed +=__dentry_leases_walk(mdsc, , __dir_lease_check);
+   freed += __dentry_leases_walk(mdsc, , __dir_lease_check);
if (!lwc.nr_to_scan) /* more to check */
return -EAGAIN;
 
diff

[PATCH] ceph: minor coding style tweaks

2021-02-03 Thread Zhiyuan Dai
Fixed some coding style issues, improve code reading.

Signed-off-by: Zhiyuan Dai 
---
 fs/ceph/addr.c   |  3 +--
 fs/ceph/cache.c  | 14 +++---
 fs/ceph/caps.c   |  2 +-
 fs/ceph/dir.c|  6 +++---
 fs/ceph/export.c |  2 +-
 fs/ceph/inode.c  |  6 +++---
 fs/ceph/locks.c  |  2 +-
 fs/ceph/mds_client.c |  8 
 fs/ceph/mdsmap.c |  4 ++--
 fs/ceph/snap.c   |  6 +++---
 fs/ceph/xattr.c  |  4 ++--
 11 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 9505529..94ce73e 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -493,8 +493,7 @@ static int ceph_readpages(struct file *file, struct 
address_space *mapping,
return rc;
 }
 
-struct ceph_writeback_ctl
-{
+struct ceph_writeback_ctl {
loff_t i_size;
u64 truncate_size;
u32 truncate_seq;
diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c
index 2f5cb6b..795523e 100644
--- a/fs/ceph/cache.c
+++ b/fs/ceph/cache.c
@@ -50,7 +50,7 @@ void ceph_fscache_unregister(void)
fscache_unregister_netfs(_cache_netfs);
 }
 
-int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc)
+int ceph_fscache_register_fs(struct ceph_fs_client *fsc, struct fs_context *fc)
 {
const struct ceph_fsid *fsid = >client->fsid;
const char *fscache_uniq = fsc->mount_options->fscache_uniq;
@@ -110,8 +110,8 @@ static enum fscache_checkaux ceph_fscache_inode_check_aux(
loff_t object_size)
 {
struct ceph_aux_inode aux;
-   struct ceph_inode_info* ci = cookie_netfs_data;
-   struct inode* inode = >vfs_inode;
+   struct ceph_inode_info *ci = cookie_netfs_data;
+   struct inode *inode = >vfs_inode;
 
if (dlen != sizeof(aux) ||
i_size_read(inode) != object_size)
@@ -164,9 +164,9 @@ void ceph_fscache_register_inode_cookie(struct inode *inode)
inode_unlock(inode);
 }
 
-void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info* ci)
+void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info *ci)
 {
-   struct fscache_cookie* cookie;
+   struct fscache_cookie *cookie;
 
if ((cookie = ci->fscache) == NULL)
return;
@@ -296,7 +296,7 @@ void ceph_readpage_to_fscache(struct inode *inode, struct 
page *page)
 fscache_uncache_page(ci->fscache, page);
 }
 
-void ceph_invalidate_fscache_page(struct inode* inode, struct page *page)
+void ceph_invalidate_fscache_page(struct inode *inode, struct page *page)
 {
struct ceph_inode_info *ci = ceph_inode(inode);
 
@@ -307,7 +307,7 @@ void ceph_invalidate_fscache_page(struct inode* inode, 
struct page *page)
fscache_uncache_page(ci->fscache, page);
 }
 
-void ceph_fscache_unregister_fs(struct ceph_fs_client* fsc)
+void ceph_fscache_unregister_fs(struct ceph_fs_client *fsc)
 {
if (fscache_cookie_valid(fsc->fscache)) {
struct ceph_fscache_entry *ent;
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 255a512..39fe5d8 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2270,7 +2270,7 @@ static int caps_are_flushed(struct inode *inode, u64 
flush_tid)
 
spin_lock(>i_ceph_lock);
if (!list_empty(>i_cap_flush_list)) {
-   struct ceph_cap_flush * cf =
+   struct ceph_cap_flush *cf =
list_first_entry(>i_cap_flush_list,
 struct ceph_cap_flush, i_list);
if (cf->tid <= flush_tid)
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 858ee73..2b7edd00 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1269,7 +1269,7 @@ void __ceph_dentry_lease_touch(struct ceph_dentry_info 
*di)
spin_unlock(>dentry_list_lock);
 }
 
-static void __dentry_dir_lease_touch(struct ceph_mds_client* mdsc,
+static void __dentry_dir_lease_touch(struct ceph_mds_client *mdsc,
 struct ceph_dentry_info *di)
 {
di->flags &= ~(CEPH_DENTRY_LEASE_LIST | CEPH_DENTRY_REFERENCED);
@@ -1351,7 +1351,7 @@ struct ceph_lease_walk_control {
 {
struct ceph_dentry_info *di, *tmp;
struct dentry *dentry, *last = NULL;
-   struct list_head* list;
+   struct list_head *list;
 LIST_HEAD(dispose);
unsigned long freed = 0;
int ret = 0;
@@ -1498,7 +1498,7 @@ int ceph_trim_dentries(struct ceph_mds_client *mdsc)
lwc.dir_lease = true;
lwc.expire_dir_lease = freed < count;
lwc.dir_lease_ttl = mdsc->fsc->mount_options->caps_wanted_delay_max * 
HZ;
-   freed +=__dentry_leases_walk(mdsc, , __dir_lease_check);
+   freed += __dentry_leases_walk(mdsc, , __dir_lease_check);
if (!lwc.nr_to_scan) /* more to check */
return -EAGAIN;
 
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index e088843..83ec43f 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -343,7 +343,7 @@ static 

[PATCH] arm64: improve whitespace

2021-02-03 Thread Zhiyuan Dai
In a few places we don't have whitespace between macro parameters,
which makes them hard to read. This patch adds whitespace to clearly
separate the parameters.

In a few places we have unnecessary whitespace around unary operators,
which is confusing, This patch removes the unnecessary whitespace.

Signed-off-by: Zhiyuan Dai 
---
 arch/arm64/kernel/alternative.c | 2 +-
 arch/arm64/kernel/module-plts.c | 2 +-
 arch/arm64/kernel/perf_event.c  | 2 +-
 arch/arm64/kernel/process.c | 4 ++--
 arch/arm64/kernel/traps.c   | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c
index a57cffb..1184c44 100644
--- a/arch/arm64/kernel/alternative.c
+++ b/arch/arm64/kernel/alternative.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 
-#define __ALT_PTR(a,f) ((void *)&(a)->f + (a)->f)
+#define __ALT_PTR(a, f)((void *)&(a)->f + (a)->f)
 #define ALT_ORIG_PTR(a)__ALT_PTR(a, orig_offset)
 #define ALT_REPL_PTR(a)__ALT_PTR(a, alt_offset)
 
diff --git a/arch/arm64/kernel/module-plts.c b/arch/arm64/kernel/module-plts.c
index 2e22443..e53493d 100644
--- a/arch/arm64/kernel/module-plts.c
+++ b/arch/arm64/kernel/module-plts.c
@@ -131,7 +131,7 @@ u64 module_emit_veneer_for_adrp(struct module *mod, 
Elf64_Shdr *sechdrs,
 }
 #endif
 
-#define cmp_3way(a,b)  ((a) < (b) ? -1 : (a) > (b))
+#define cmp_3way(a, b) ((a) < (b) ? -1 : (a) > (b))
 
 static int cmp_rela(const void *a, const void *b)
 {
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index 3605f77a..d1fec4a 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -810,7 +810,7 @@ static int armv8pmu_get_single_idx(struct pmu_hw_events 
*cpuc,
 {
int idx;
 
-   for (idx = ARMV8_IDX_COUNTER0; idx < cpu_pmu->num_events; idx ++) {
+   for (idx = ARMV8_IDX_COUNTER0; idx < cpu_pmu->num_events; idx++) {
if (!test_and_set_bit(idx, cpuc->used_mask))
return idx;
}
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 6616486..4cc1ccc 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -304,7 +304,7 @@ void __show_regs(struct pt_regs *regs)
}
 }
 
-void show_regs(struct pt_regs * regs)
+void show_regs(struct pt_regs *regs)
 {
__show_regs(regs);
dump_backtrace(regs, NULL, KERN_DEFAULT);
@@ -587,7 +587,7 @@ unsigned long get_wchan(struct task_struct *p)
ret = frame.pc;
goto out;
}
-   } while (count ++ < 16);
+   } while (count++ < 16);
 
 out:
put_task_stack(p);
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 6895ce7..a05d34f 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -45,7 +45,7 @@
 #include 
 #include 
 
-static const char *handler[]= {
+static const char *handler[] = {
"Synchronous Abort",
"IRQ",
"FIQ",
-- 
1.8.3.1



[PATCH 2/2] arm64/kernel: improve the coding style

2021-02-02 Thread Zhiyuan Dai
Just improve the coding style.

Signed-off-by: Zhiyuan Dai 
---
 arch/arm64/kernel/alternative.c | 2 +-
 arch/arm64/kernel/module-plts.c | 2 +-
 arch/arm64/kernel/perf_event.c  | 2 +-
 arch/arm64/kernel/process.c | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c
index a57cffb..1184c44 100644
--- a/arch/arm64/kernel/alternative.c
+++ b/arch/arm64/kernel/alternative.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 
-#define __ALT_PTR(a,f) ((void *)&(a)->f + (a)->f)
+#define __ALT_PTR(a, f)((void *)&(a)->f + (a)->f)
 #define ALT_ORIG_PTR(a)__ALT_PTR(a, orig_offset)
 #define ALT_REPL_PTR(a)__ALT_PTR(a, alt_offset)
 
diff --git a/arch/arm64/kernel/module-plts.c b/arch/arm64/kernel/module-plts.c
index 2e22443..e53493d 100644
--- a/arch/arm64/kernel/module-plts.c
+++ b/arch/arm64/kernel/module-plts.c
@@ -131,7 +131,7 @@ u64 module_emit_veneer_for_adrp(struct module *mod, 
Elf64_Shdr *sechdrs,
 }
 #endif
 
-#define cmp_3way(a,b)  ((a) < (b) ? -1 : (a) > (b))
+#define cmp_3way(a, b) ((a) < (b) ? -1 : (a) > (b))
 
 static int cmp_rela(const void *a, const void *b)
 {
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index 3605f77a..d1fec4a 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -810,7 +810,7 @@ static int armv8pmu_get_single_idx(struct pmu_hw_events 
*cpuc,
 {
int idx;
 
-   for (idx = ARMV8_IDX_COUNTER0; idx < cpu_pmu->num_events; idx ++) {
+   for (idx = ARMV8_IDX_COUNTER0; idx < cpu_pmu->num_events; idx++) {
if (!test_and_set_bit(idx, cpuc->used_mask))
return idx;
}
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 6616486..4cc1ccc 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -304,7 +304,7 @@ void __show_regs(struct pt_regs *regs)
}
 }
 
-void show_regs(struct pt_regs * regs)
+void show_regs(struct pt_regs *regs)
 {
__show_regs(regs);
dump_backtrace(regs, NULL, KERN_DEFAULT);
@@ -587,7 +587,7 @@ unsigned long get_wchan(struct task_struct *p)
ret = frame.pc;
goto out;
}
-   } while (count ++ < 16);
+   } while (count++ < 16);
 
 out:
put_task_stack(p);
-- 
1.8.3.1



[PATCH] arm64/kernel: minor coding style tweaks

2021-02-02 Thread Zhiyuan Dai
Fixed two coding style issues in kernel/trap.c
1. spaces required around that '='
2. Missing a blank line after declarations

Signed-off-by: Zhiyuan Dai 
---
 arch/arm64/kernel/traps.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 6895ce7..4001a39 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -45,7 +45,7 @@
 #include 
 #include 
 
-static const char *handler[]= {
+static const char *handler[] = {
"Synchronous Abort",
"IRQ",
"FIQ",
@@ -318,6 +318,7 @@ static int call_undef_hook(struct pt_regs *regs)
} else if (compat_thumb_mode(regs)) {
/* 16-bit Thumb instruction */
__le16 instr_le;
+
if (get_user(instr_le, (__le16 __user *)pc))
goto exit;
instr = le16_to_cpu(instr_le);
@@ -332,6 +333,7 @@ static int call_undef_hook(struct pt_regs *regs)
} else {
/* 32-bit ARM instruction */
__le32 instr_le;
+
if (get_user(instr_le, (__le32 __user *)pc))
goto exit;
instr = le32_to_cpu(instr_le);
-- 
1.8.3.1



[PATCH] mm/hugetlb.c: Fix typos in comments

2021-02-02 Thread Zhiyuan Dai
Fix typos in comments

Signed-off-by: Zhiyuan Dai 
---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 18f6ee3..35db386 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3990,7 +3990,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, 
unsigned long start,
 
 /*
  * This is called when the original mapper is failing to COW a MAP_PRIVATE
- * mappping it owns the reserve page for. The intention is to unmap the page
+ * mapping it owns the reserve page for. The intention is to unmap the page
  * from other VMAs and let the children be SIGKILLed if they are faulting the
  * same region.
  */
-- 
1.8.3.1



mm/hugetlb.c: Fix typos in comments

2021-02-02 Thread Zhiyuan Dai
Signed-off-by: Zhiyuan Dai 
---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 18f6ee3..35db386 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3990,7 +3990,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, 
unsigned long start,
 
 /*
  * This is called when the original mapper is failing to COW a MAP_PRIVATE
- * mappping it owns the reserve page for. The intention is to unmap the page
+ * mapping it owns the reserve page for. The intention is to unmap the page
  * from other VMAs and let the children be SIGKILLed if they are faulting the
  * same region.
  */
-- 
1.8.3.1



[PATCH] mm/hugetlb.c: Fix typos in comments

2021-02-02 Thread Zhiyuan Dai
Signed-off-by: Zhiyuan Dai 
---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 18f6ee3..35db386 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3990,7 +3990,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, 
unsigned long start,
 
 /*
  * This is called when the original mapper is failing to COW a MAP_PRIVATE
- * mappping it owns the reserve page for. The intention is to unmap the page
+ * mapping it owns the reserve page for. The intention is to unmap the page
  * from other VMAs and let the children be SIGKILLed if they are faulting the
  * same region.
  */
-- 
1.8.3.1



mm/hugetlb.c: Fix typos in comments

2021-02-02 Thread Zhiyuan Dai
mm/hugetlb.c: Fix typos in comments

Signed-off-by: Zhiyuan Dai 
---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 18f6ee3..35db386 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3990,7 +3990,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, 
unsigned long start,
 
 /*
  * This is called when the original mapper is failing to COW a MAP_PRIVATE
- * mappping it owns the reserve page for. The intention is to unmap the page
+ * mapping it owns the reserve page for. The intention is to unmap the page
  * from other VMAs and let the children be SIGKILLed if they are faulting the
  * same region.
  */
-- 
1.8.3.1



mm/hugetlb.c: Fix typos in comments

2021-02-02 Thread Zhiyuan Dai
Fix typos in comments.

Signed-off-by: Zhiyuan Dai 
---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 18f6ee3..35db386 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3990,7 +3990,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, 
unsigned long start,
 
 /*
  * This is called when the original mapper is failing to COW a MAP_PRIVATE
- * mappping it owns the reserve page for. The intention is to unmap the page
+ * mapping it owns the reserve page for. The intention is to unmap the page
  * from other VMAs and let the children be SIGKILLed if they are faulting the
  * same region.
  */
-- 
1.8.3.1