* [PATCH] mm: thp: simplify split_huge_pages_pid()
@ 2024-09-05 15:30 Nanyong Sun
0 siblings, 0 replies; only message in thread
From: Nanyong Sun @ 2024-09-05 15:30 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, linux-kernel, wangkefeng.wang, sunnanyong
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.
Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
---
mm/huge_memory.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 67c86a5d64a6..c5349c2a8275 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3480,16 +3480,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);
--
2.33.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-09-05 15:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-05 15:30 [PATCH] mm: thp: simplify split_huge_pages_pid() Nanyong Sun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox