Re: [PATCH] mm: align up min_free_kbytes to multipy of 4

2019-06-11 Thread Chengang (L)
Hi Michal >On Sun 09-06-19 17:10:28, ChenGang wrote: >> Usually the value of min_free_kbytes is multiply of 4, and in this >> case ,the right shift is ok. >> But if it's not, the right-shifting operation will lose the low 2 >> bits, and this cause kernel don

Re: [PATCH] mm: align up min_free_kbytes to multipy of 4

2019-06-11 Thread Chengang (L)
Hi Wei Yang >On Sun, Jun 09, 2019 at 05:10:28PM +0800, ChenGang wrote: >>Usually the value of min_free_kbytes is multiply of 4, and in this case >>,the right shift is ok. >>But if it's not, the right-shifting operation will lose the low 2 bits, >But PAGE_SHIFT is no

[PATCH] mm: align up min_free_kbytes to multipy of 4

2019-06-09 Thread ChenGang
tiply of 4. For example, if min_free_kbytes is 64, then should keep 16 pages, but if min_free_kbytes is 65 or 66, then should keep 17 pages. Signed-off-by: ChenGang --- mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d

[PATCH] uapi: adfs_fs: Clean up code

2016-10-15 Thread chengang
From: Chen Gang Use tab instead of 4 white spaces for indent, and remove redundant empty line. Put constant macro definition before structure definition, so that the structure definition can use the constant macro, e.g. ADFS_DR_SIZE. And still left hardcode number "52" for unused52, since the n

[PATCH] uapi: linux: acct: Remove redundant type comp2_t from kernel

2016-10-05 Thread chengang
From: Chen Gang In api itself, kernel does not use it -- it is divided into ac_etime_hi and ac_etime_lo. So kernel side only need generate the correct ac_etime_hi and ac_etime_lo, but need not know about comp2_t. At present, kernel use normal u64 type for it, when kernel provdes it to outside, k

[PATCH] mm: migrate: Return false instead of -EAGAIN for dummy functions

2016-09-17 Thread chengang
From: Chen Gang For migrate_misplaced_page and migrate_misplaced_transhuge_page, they are pure Boolean functions and are also used as pure Boolean functions, but the related dummy functions return -EAGAIN. Also change their related pure Boolean function numamigrate_isolate_page. For variable is

[PATCH v2] arch: all: include: asm: bitops: Use bool instead of int for all bit test functions

2016-08-28 Thread chengang
From: Chen Gang Also use the same changing to asm-generic, and also use bool variable instead of int variable for mips, mn10300, parisc and tile related functions, and also avoid checkpatch.pl to report ERROR. Include linux/types.h for alpha, arm, arm64, m68k, and openrisc to pass building. Ori

[PATCH] arch: all: include: asm: bitops: Use bool instead of int for all bit test functions

2016-08-27 Thread chengang
From: Chen Gang Also use the same changing to asm-generic, and also use bool variable instead of int variable for mips, mn10300, parisc and tile related functions, and also avoid checkpatch.pl to report ERROR. Originally, except powerpc and xtensa, all another architectures intend to return 0 or

[PATCH v2] include: mman: Use bool instead of int for the return value of arch_validate_prot

2016-07-23 Thread chengang
From: Chen Gang For pure bool function's return value, bool is a little better more or less than int. Signed-off-by: Chen Gang --- arch/powerpc/include/asm/mman.h | 8 include/linux/mman.h| 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/i

[PATCH] mm: gup: Re-define follow_page_mask output parameter page_mask usage

2016-07-09 Thread chengang
From: Chen Gang For a pure output parameter: - When callee fails, the caller should not assume the output parameter is still valid. - And callee should not assume the pure output parameter must be provided by caller -- caller has right to pass NULL when caller does not care about it.

[PATCH] include: mman: Use bool instead of int for the return value of arch_validate_prot

2016-07-09 Thread chengang
From: Chen Gang For pure bool function's return value, bool is a little better more or less than int. And return boolean result directly. Since 'if' statement is also for boolean checking, and return boolean result, too. Signed-off-by: Chen Gang --- arch/powerpc/include/asm/mman.h | 8 +++

[PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable

2016-07-09 Thread chengang
From: Chen Gang For pure bool function's return value, bool is a little better more or less than int. And return boolean result directly, since 'if' statement is also for boolean checking, and return boolean result, too. Signed-off-by: Chen Gang --- include/linux/migrate.h | 4 ++-- mm/compac

[PATCH] arch/blackfin/kernel/module.c: Use KBUILD_MODNAME instead of mod->name for pr_fmt()

2016-06-10 Thread chengang
From: Chen Gang When use pr_warn(), it will break building because of mod undefined, so fix it just like another architectures have done. Signed-off-by: Chen Gang --- arch/blackfin/kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/blackfin/kernel/module.c

[PATCH trivial] include/linux/mempolicy.h: Clean up code

2016-06-09 Thread chengang
From: Chen Gang Use one return statement instead of multiple statements, since the new return statement is still simple enough. Let the second line function parameter almost align with the first line function parameter. Signed-off-by: Chen Gang --- include/linux/mempolicy.h | 18 ++---

[PATCH trivial] include/linux/memory_hotplug.h: Clean up code

2016-06-09 Thread chengang
From: Chen Gang Use one line instead of two lines for pgdat_resize_init, since one line is still within 80 columns. Let the second line function parameter almost align with the first line parameter. Use pr_warn instead of printk, so also let the line within 80 columns. Signed-off-by: Chen Gang

[PATCH trivial] include/linux/memcontrol.h: Clean up code only

2016-06-09 Thread chengang
From: Chen Gang Merge several statements to one return statement, since the new return statement is still simple enough. Try to let the second line function parameters almost align with the first line parameter (try to be within 80 columns, and in one line). The comments can fully use 80 column

[PATCH v2 trivial] include/linux/memblock.h: Clean up code for several trivial details

2016-06-02 Thread chengang
From: Chen Gang Correct the function parameters alignment, since original code already use both tabs and white spaces together for the incorrect parameters alignment functions. If one line can hold one statement within 80 columns, let it in one line (original code did not consider about the tabs

[PATCH trivial] include/linux/memblock.h: Clean up code for several trivial details

2016-05-29 Thread chengang
From: Chen Gang Correct the function parameters alignment, since original code already use both tabs and white spaces together for the incorrect parameters alignment functions. If one line can hold one statement within 80 columns, let it in one line (original code did not consider about the tabs

[PATCH] include/linux/khugepaged.h: Improve the code only

2016-05-15 Thread chengang
From: Chen Gang khugepaged_enabled() can be treated as khugepaged_always() or khugepaged_req_madv(). The compiler will always treat it as "and 3". khugepaged_enter() can return __khugepaged_enter() result directly, since __khugepaged_enter() will return 0 or -ENOMEM. Signed-off-by: Chen Gang -

[PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled()

2016-05-01 Thread chengang
From: Chen Gang According to kasan_[dis|en]able_current() comments and the kasan_depth' s initialization, if kasan_depth is zero, it means disable. So need use "!!kasan_depth" instead of "!kasan_depth" for checking enable. Signed-off-by: Chen Gang --- mm/kasan/kasan.h | 2 +- 1 file changed,

[PATCH] include/linux/kasan.h: Notice about 0 for kasan_[dis/en]able_current()

2016-05-01 Thread chengang
From: Chen Gang According to their comments and the kasan_depth's initialization, if kasan_depth is zero, it means disable. So kasan_depth need consider about the 0 overflow. Also remove useless comments for dummy kasan_slab_free(). Signed-off-by: Chen Gang --- include/linux/kasan.h | 8 -

[PATCH] include/linux/hugetlb.h: Use bool instead of int for hugepage_migration_supported()

2016-04-10 Thread chengang
From: Chen Gang It is used as a pure bool function within kernel source wide. Signed-off-by: Chen Gang --- include/linux/hugetlb.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index e44c578..0f735ea 100644 --- a/inc

[PATCH trivial] include : linux: hugetlb: Clean up code

2016-04-10 Thread chengang
From: Chen Gang Macro HUGETLBFS_SB is clearer enough, so one statement is clearer than 3 lines statements. Remove redundant return statements for non-return functions, which can save lines, at least. Signed-off-by: Chen Gang --- include/linux/hugetlb.h| 4 +--- include/linux/hugetlb_c

[PATCH trivial] include/linux/huge_mm.h: Return NULL instead of false for pmd_trans_huge_lock()

2016-03-28 Thread chengang
From: Chen Gang The return value of pmd_trans_huge_lock() is a pointer, not a boolean value, so use NULL instead of false as the return value. Signed-off-by: Chen Gang --- include/linux/huge_mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/huge_mm.h b/incl

[PATCH trivial] include/linux/gfp.h: Improve the coding styles

2016-02-24 Thread chengang
From: Chen Gang Always notice about 80 columns, and the white space near '|'. Let the wrapped function parameters align as the same styles. Remove redundant statement "enum zone_type z;" in function gfp_zone. Signed-off-by: Chen Gang --- include/linux/gfp.h | 35 -

[PATCH] include/linux/list_bl.h: Use bool instead of int for boolean functions

2016-01-24 Thread chengang
From: Chen Gang hlist_bl_unhashed() and hlist_bl_empty() are all boolean functions, so return bool instead of int. Signed-off-by: Chen Gang --- include/linux/list_bl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h inde

[PATCH] include/linux/cleancache.h: Clean up code

2016-01-06 Thread chengang
From: Chen Gang Let cleancache_fs_enabled() call cleancache_fs_enabled_mapping() directly. Remove redundant variable ret in cleancache_get_page(). Signed-off-by: Chen Gang --- include/linux/cleancache.h | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/include

[PATCH] include/linux/memblock.h: Use __init_memblock for movable_node_is_enabled

2016-01-05 Thread chengang
From: Chen Gang The related warning: LD mm/built-in.o WARNING: mm/built-in.o(.text.unlikely+0x155d): Section mismatch in reference from the function movable_node_is_enabled() to the variable .meminit.data:movable_node_enabled The function movable_node_is_enabled() references the

[PATCH] arch/x86/kernel/ptrace.c: Remove redundant arg_offs_table

2015-12-26 Thread chengang
From: Chen Gang The related warning from gcc 6.0: arch/x86/kernel/ptrace.c:127:18: warning: ‘arg_offs_table’ defined but not used [-Wunused-const-variable] static const int arg_offs_table[] = { ^~ Signed-off-by: Chen Gang --- arch/x86/kernel/ptrace.c | 15

[PATCH] kernel: rcu: tree: Remove useless rcu_data_p when !PREEMPT_RCU

2015-12-26 Thread chengang
From: Chen Gang The related warning from gcc 6.0: In file included from kernel/rcu/tree.c:4630:0: kernel/rcu/tree_plugin.h:810:40: warning: ‘rcu_data_p’ defined but not used [-Wunused-const-variable] static struct rcu_data __percpu *const rcu_data_p = &rcu_sched_data;

[PATCH] include/linux/amd-iommu.h: Move to arch/x86/include/asm

2015-12-26 Thread chengang
From: Chen Gang It is architecture specific mechanism header, not generic header, so move it to arch/x86/include/asm. ALso change all related contents for it. Signed-off-by: Chen Gang --- MAINTAINERS | 2 +- {include/linux => arch/x86/include/asm}/amd-i