From: Zhou Guanghui zhouguanghui1@huawei.com
ascend inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4EUVI CVE: NA
-------------------------------------------------------
Remove unnecessary params(pid, spg_id) of sp_unshare.
Signed-off-by: Zhou Guanghui zhouguanghui1@huawei.com Reviewed-by: Ding Tianhong dingtianhong@huawei.com Reviewed-by: Weilong Chen chenweilong@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- include/linux/share_pool.h | 2 +- mm/share_pool.c | 19 +++---------------- 2 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/include/linux/share_pool.h b/include/linux/share_pool.h index 5912d874b05fb..2b052efa69072 100644 --- a/include/linux/share_pool.h +++ b/include/linux/share_pool.h @@ -216,7 +216,7 @@ extern int sp_free(unsigned long addr); extern void *sp_make_share_k2u(unsigned long kva, unsigned long size, unsigned long sp_flags, int pid, int spg_id); extern void *sp_make_share_u2k(unsigned long uva, unsigned long size, int pid); -extern int sp_unshare(unsigned long va, unsigned long size, int pid, int spg_id); +extern int sp_unshare(unsigned long va, unsigned long size);
extern void sp_area_drop(struct vm_area_struct *vma);
diff --git a/mm/share_pool.c b/mm/share_pool.c index 6971076a4c57c..8b9a4acea9b76 100644 --- a/mm/share_pool.c +++ b/mm/share_pool.c @@ -2705,7 +2705,7 @@ EXPORT_SYMBOL_GPL(sp_make_share_u2k); * * This also means we must trust DVPP channel destroy and guard worker code. */ -static int sp_unshare_uva(unsigned long uva, unsigned long size, int pid, int spg_id) +static int sp_unshare_uva(unsigned long uva, unsigned long size) { int ret = 0; bool found = false; @@ -2752,11 +2752,6 @@ static int sp_unshare_uva(unsigned long uva, unsigned long size, int pid, int sp }
if (spa->type == SPA_TYPE_K2TASK) { - if (spg_id != SPG_ID_NONE && spg_id != SPG_ID_DEFAULT) { - pr_err_ratelimited("share pool: unshare uva(to task) failed, invalid spg id %d\n", spg_id); - ret = -EINVAL; - goto out_drop_area; - }
if (!spa->mm) { pr_err_ratelimited("share pool: unshare uva(to task) failed, none spa owner\n"); @@ -2808,12 +2803,6 @@ static int sp_unshare_uva(unsigned long uva, unsigned long size, int pid, int sp sp_update_process_stat(current, false, spa);
} else if (spa->type == SPA_TYPE_K2SPG) { - if (spg_id < 0) { - pr_err_ratelimited("share pool: unshare uva(to group) failed, invalid spg id %d\n", spg_id); - ret = -EINVAL; - goto out_drop_area; - } - down_read(&spa->spg->rw_lock); /* always allow kthread and dvpp channel destroy procedure */ if (current->mm) { @@ -2921,14 +2910,12 @@ static int sp_unshare_kva(unsigned long kva, unsigned long size) * sp_make_share_{k2u,u2k}(). * @va: the specified virtual address of memory * @size: the size of unshared memory - * @pid: the pid of the specified process if the VA is user address - * @spg_id: the ID of the specified sp_group if the VA is user address * * Use spg_id of current thread if spg_id == SPG_ID_DEFAULT. * * Return: 0 for success, -errno on failure. */ -int sp_unshare(unsigned long va, unsigned long size, int pid, int spg_id) +int sp_unshare(unsigned long va, unsigned long size) { int ret = 0;
@@ -2936,7 +2923,7 @@ int sp_unshare(unsigned long va, unsigned long size, int pid, int spg_id)
if (va < TASK_SIZE) { /* user address */ - ret = sp_unshare_uva(va, size, pid, spg_id); + ret = sp_unshare_uva(va, size); } else if (va >= VA_START) { /* kernel address */ ret = sp_unshare_kva(va, size);