From: Zhou Guanghui zhouguanghui1@huawei.com
ascend inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4EUVI CVE: NA
----------------------------------------------------------- Solving the Problem that the 4G DVPP Address with Shared Pool coexist.
Signed-off-by: Zhou Guanghui zhouguanghui1@huawei.com Reviewed-by: Weilong Chen chenweilong@huawei.com Reviewed-by: Ding Tianhong dingtianhong@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- include/linux/share_pool.h | 11 ++++++++--- mm/mmap.c | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/linux/share_pool.h b/include/linux/share_pool.h index 442ee1ed5fa65..cd4c305449dd9 100644 --- a/include/linux/share_pool.h +++ b/include/linux/share_pool.h @@ -281,9 +281,13 @@ static inline bool sp_check_vm_huge_page(unsigned long flags) return false; }
-static inline void sp_area_work_around(struct vm_unmapped_area_info *info) +static inline void sp_area_work_around(struct vm_unmapped_area_info *info, + unsigned long flags) { - if (enable_ascend_share_pool) + /* the MAP_DVPP couldn't work with MAP_SHARE_POOL. In addition, the + * address ranges corresponding to the two flags must not overlap. + */ + if (enable_ascend_share_pool && !(flags & MAP_DVPP)) info->high_limit = min(info->high_limit, MMAP_SHARE_POOL_START); }
@@ -554,7 +558,8 @@ static inline bool sp_check_vm_huge_page(unsigned long flags) return false; }
-static inline void sp_area_work_around(struct vm_unmapped_area_info *info) +static inline void sp_area_work_around(struct vm_unmapped_area_info *info, + unsigned long flags) { }
diff --git a/mm/mmap.c b/mm/mmap.c index 4c8092b2f26fd..e529384b8ac62 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2380,7 +2380,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, if (enable_mmap_dvpp) dvpp_mmap_get_area(&info, flags);
- sp_area_work_around(&info); + sp_area_work_around(&info, flags);
return vm_unmapped_area(&info); } @@ -2435,7 +2435,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, if (enable_mmap_dvpp) dvpp_mmap_get_area(&info, flags);
- sp_area_work_around(&info); + sp_area_work_around(&info, flags);
addr = vm_unmapped_area(&info);
@@ -2454,7 +2454,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, if (enable_mmap_dvpp) dvpp_mmap_get_area(&info, flags);
- sp_area_work_around(&info); + sp_area_work_around(&info, flags);
addr = vm_unmapped_area(&info); }