diff options
author | Nanyong Sun <sunnanyong@huawei.com> | 2024-09-05 17:30:28 +0200 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-09-10 01:39:15 +0200 |
commit | e4bfc678579eb32360cdd09503c8fe62f943bc3f (patch) | |
tree | 9346952ac4042d4ec4221176856a963686b29fd7 /mm | |
parent | mm: migrate: simplify find_mm_struct() (diff) | |
download | linux-e4bfc678579eb32360cdd09503c8fe62f943bc3f.tar.xz linux-e4bfc678579eb32360cdd09503c8fe62f943bc3f.zip |
mm: thp: simplify split_huge_pages_pid()
The helper find_get_task_by_vpid() can totally replace the task_struct
find logic in split_huge_pages_pid(), so use it to simplify the code.
Also delete the needless comments for the helper function name already
explains what it's doing here.
Link: https://lkml.kernel.org/r/20240905153028.1205128-1-sunnanyong@huawei.com
Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/huge_memory.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 77092581f90d..f15f7faf2a63 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3819,16 +3819,11 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start, vaddr_start &= PAGE_MASK; vaddr_end &= PAGE_MASK; - /* Find the task_struct from pid */ - rcu_read_lock(); - task = find_task_by_vpid(pid); + task = find_get_task_by_vpid(pid); if (!task) { - rcu_read_unlock(); ret = -ESRCH; goto out; } - get_task_struct(task); - rcu_read_unlock(); /* Find the mm_struct */ mm = get_task_mm(task); |