[PATCH] kernel/futex.c: fix incorrect 'should_fail_futex' handling

2020-09-26 Thread mateusznosek0
From: Mateusz Nosek Previously if 'futex_should_fail' returned true, then only 'ret' variable was set, which was later overwritten without being read. The patch fixes the problem. Signed-off-by: Mateusz Nosek --- kernel/futex.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --g

[PATCH] mm/page_alloc.c: Clean code by removing unnecessary initialization

2020-09-04 Thread mateusznosek0
From: Mateusz Nosek Previously variable 'tmp' was initialized, but was not read later before reassigning. So the initialization can be removed. Signed-off-by: Mateusz Nosek --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c

[PATCH] mm/mmu_notifier.c: micro-optimization substitute kzalloc with kmalloc

2020-09-06 Thread mateusznosek0
From: Mateusz Nosek Most fields in struct pointed by 'subscriptions' are initialized explicitly after the allocation. By changing kzalloc to kmalloc the call to memset is avoided. As the only new code consists of 2 simple memory accesses, the performance is increased. Signed-off-by: Mateusz Nose

[PATCH] mm/page_poison.c: replace bool variable with static key

2020-09-21 Thread mateusznosek0
From: Mateusz Nosek Variable 'want_page_poisoning' is a switch deciding if page poisoning should be enabled. This patch changes it to be static key. Signed-off-by: Mateusz Nosek --- mm/page_poison.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/mm/pa

[PATCH] mm/page_alloc.c: micro-optimization remove unnecessary branch

2020-09-11 Thread mateusznosek0
From: Mateusz Nosek Previously flags check was separated into two separated checks with two separated branches. In case of presence of any of two mentioned flags, the same effect on flow occurs. Therefore checks can be merged and one branch can be avoided. Signed-off-by: Mateusz Nosek --- mm/p

[PATCH] fs/aio.c: clean code by removing unnecessary assignment

2020-09-11 Thread mateusznosek0
From: Mateusz Nosek Variable 'ret' is reassigned before used otherwise, so the assignment is unnecessary and therefore can be removed. Signed-off-by: Mateusz Nosek --- fs/aio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/aio.c b/fs/aio.c index 42154e7c44cb..0a0e5cefa1c4 100644 --- a/

[PATCH] fs/pipe.c: clean code by removing unnecessary initialization

2020-09-12 Thread mateusznosek0
From: Mateusz Nosek Previously variable 'buf' was initialized, but was not read later before reassigning. So the initialization can be removed. Signed-off-by: Mateusz Nosek --- fs/pipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/pipe.c b/fs/pipe.c index 60dbee4571

[PATCH] mm/compaction.c: micro-optimization remove unnecessary branch

2020-09-13 Thread mateusznosek0
From: Mateusz Nosek The same code can work both for 'zone->compact_considered > defer_limit' and 'zone->compact_considered >= defer_limit'. In the latter there is one branch less which is more effective considering performance. Signed-off-by: Mateusz Nosek --- mm/compaction.c | 5 ++--- 1 file

[RFC PATCH] mm/page_alloc.c: micro-optimization reduce oom critical section size

2020-09-14 Thread mateusznosek0
From: Mateusz Nosek Most operations from '__alloc_pages_may_oom' do not require oom_mutex hold. Exception is 'out_of_memory'. The patch refactors '__alloc_pages_may_oom' to reduce critical section size and improve overall system performance. Signed-off-by: Mateusz Nosek --- mm/page_alloc.c | 4

[RFC PATCH] fs: micro-optimization remove branches by adjusting flag values

2020-09-14 Thread mateusznosek0
From: Mateusz Nosek When flags A and B have equal values than the following code if(flags1 & A) flags2 |= B; is equivalent to flags2 |= (flags1 & A); The latter code should generate less instructions and be faster as one branch is omitted in it. Introduced patch changes the value of

[PATCH] fs/open.c: micro-optimization by avoiding branch on common path

2020-09-18 Thread mateusznosek0
From: Mateusz Nosek If file is a directory it is surely not regular. Therefore, if 'S_ISREG' check returns false one can be sure that vfs_truncate must returns with error. Introduced patch refactors code to avoid one branch in 'likely' control flow path. Moreover, it marks the proper check with '

[RFC PATCH] mm/page_alloc.c: clean code by merging two functions

2020-09-16 Thread mateusznosek0
From: Mateusz Nosek The 'finalise_ac' function is just 'epilogue' for 'prepare_alloc_pages'. Therefore there is no need to keep them both so 'finalise_ac' content can be merged into 'prepare_alloc_pages' code. It would make '__alloc_pages_nodemask' cleaner when it comes to readability. Signed-of

[PATCH] mm/slab.c: micro-optimization spare one branch in main flow

2020-09-16 Thread mateusznosek0
From: Mateusz Nosek By small refactoring two 'unlikely' branches are changed so that if not one of them is true then only one branch occurs in 'likely' path of the function in question. Change verified in assembly generated by gcc 8.3.0. Signed-off-by: Mateusz Nosek --- mm/slab.c | 5 +++-- 1

[PATCH] mm/page_alloc.c: fix early params garbage value accesses

2020-09-16 Thread mateusznosek0
From: Mateusz Nosek Previously in '__init early_init_on_alloc' and '__init early_init_on_free' the return values from 'kstrtobool' were not handled properly. That caused potential garbage value read from variable 'bool_result'. Introduced patch fixes error handling. Signed-off-by: Mateusz Nosek

[PATCH] include/linux/compaction.h: clean code by removing unused enum value

2020-09-17 Thread mateusznosek0
From: Mateusz Nosek The enum value 'COMPACT_INACTIVE' is never used so can be removed. Signed-off-by: Mateusz Nosek --- include/linux/compaction.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/linux/compaction.h b/include/linux/compaction.h index 25a521d299c1..1de5a1151ee7 1006

[PATCH] mmzone: clean code by removing unused macro parameter

2020-09-17 Thread mateusznosek0
From: Mateusz Nosek Previously 'for_next_zone_zonelist_nodemask' macro parameter 'zlist' was unused so this patch removes it. Signed-off-by: Mateusz Nosek --- include/linux/mmzone.h | 2 +- mm/page_alloc.c| 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/

[PATCH] mm/slab.c: clean code by removing redundant if condition

2020-09-15 Thread mateusznosek0
From: Mateusz Nosek The removed code was unnecessary and changed nothing in the flow, since in case of returning NULL by 'kmem_cache_alloc_node' returning 'freelist' from the function in question is the same as returning NULL. Signed-off-by: Mateusz Nosek --- mm/slab.c | 2 -- 1 file changed,