From: Nanyong Sun <sunnanyong@huawei.com>
To: <akpm@linux-foundation.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
<wangkefeng.wang@huawei.com>, <sunnanyong@huawei.com>
Subject: [PATCH] mm: thp: simplify split_huge_pages_pid()
Date: Thu, 5 Sep 2024 23:30:28 +0800 [thread overview]
Message-ID: <20240905153028.1205128-1-sunnanyong@huawei.com> (raw)
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
reply other threads:[~2024-09-05 15:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240905153028.1205128-1-sunnanyong@huawei.com \
--to=sunnanyong@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=wangkefeng.wang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox