diff options
author | Shiraz Hashim <shashim@codeaurora.org> | 2016-02-04 14:53:33 +0530 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:19:51 -0700 |
commit | 2f879b6dcbc9adf927c976a61ff86dc03814d979 (patch) | |
tree | 421f797a67bf59a3fc966208fa0ed13fb6368577 /include/linux/memblock.h | |
parent | f1b365a43ba4aac035f17552c76df0869cf58d53 (diff) |
mm/memblock: fix a race between search and remove
no-map-fixup feature for dma-removed reserve region does a
late memblock remove. This late removal is a slight
deviation from conventional memblock flow. That leads to a
race between pfn_valid->memblock_search, and
memblock_remove.
To fix this, use a read seqlock in memblock_search, which
would ensure minimum overhead in search path. And export
two APIs to let code doing late memblock remove apply
write seqlock. write seqlock would ensure that search
retries if the list is updated concurrently.
The two exported APIs which should be called before
and after modifying memblock regions, late in boot, are
- memblock_region_resize_late_begin
- memblock_region_resize_late_end
The code to alter memblock regions should be guarded by
these APIs.
CRs-fixed: 967728
Change-Id: I6a10c3e980002048aafeaf829a16119848c6a099
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
Diffstat (limited to 'include/linux/memblock.h')
-rw-r--r-- | include/linux/memblock.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index ea96ba46ef9d..42b40345119f 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -83,6 +83,8 @@ int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size); int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); ulong choose_memblock_flags(void); +void memblock_region_resize_late_begin(void); +void memblock_region_resize_late_end(void); /* Low level functions */ int memblock_add_range(struct memblock_type *type, |