diff options
author | Pavel Tatashin <[email protected]> | 2018-01-31 16:16:30 -0800 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2018-01-31 17:18:36 -0800 |
commit | 80b1f41c0957a9da3bab4fb9ae76dc886753a59b (patch) | |
tree | 4c2889b2809d41826aca835fb3c0225b97cce14d /kernel/gcov/base.c | |
parent | 9092c71bb724dba2ecba849eae69e5c9d39bd3d2 (diff) |
mm: split deferred_init_range into initializing and freeing parts
In deferred_init_range() we initialize struct pages, and also free them
to buddy allocator. We do it in separate loops, because buddy page is
computed ahead, so we do not want to access a struct page that has not
been initialized yet.
There is still, however, a corner case where it is potentially possible
to access uninitialized struct page: this is when buddy page is from the
next memblock range.
This patch fixes this problem by splitting deferred_init_range() into
two functions: one to initialize struct pages, and another to free them.
In addition, this patch brings the following improvements:
- Get rid of __def_free() helper function. And simplifies loop logic by
adding a new pfn validity check function: deferred_pfn_valid().
- Reduces number of variables that we track. So, there is a higher
chance that we will avoid using stack to store/load variables inside
hot loops.
- Enables future multi-threading of these functions: do initialization
in multiple threads, wait for all threads to finish, do freeing part
in multithreading.
Tested on x86 with 1T of memory to make sure no regressions are
introduced.
[[email protected]: fix spello in comment]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Pavel Tatashin <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Steven Sistare <[email protected]>
Cc: Daniel Jordan <[email protected]>
Cc: Mel Gorman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'kernel/gcov/base.c')
0 files changed, 0 insertions, 0 deletions