[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220304093409.25829-5-linmiaohe@huawei.com>
Date: Fri, 4 Mar 2022 17:33:57 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: <akpm@...ux-foundation.org>
CC: <mike.kravetz@...cle.com>, <shy828301@...il.com>,
<willy@...radead.org>, <ying.huang@...el.com>, <ziy@...dia.com>,
<minchan@...nel.org>, <apopple@...dia.com>,
<ave.hansen@...ux.intel.com>, <o451686892@...il.com>,
<almasrymina@...gle.com>, <jhubbard@...dia.com>,
<rcampbell@...dia.com>, <peterx@...hat.com>,
<naoya.horiguchi@....com>, <mhocko@...e.com>, <riel@...hat.com>,
<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
<linmiaohe@...wei.com>
Subject: [PATCH 04/16] mm/migration: reduce the rcu lock duration
rcu_read_lock is required by grabbing the task refcount but it's not
needed for ptrace_may_access. So we could release the rcu lock after
task refcount is successfully grabbed to reduce the rcu holding time.
Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
mm/migrate.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index da5a81052468..26943bd819e8 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1907,17 +1907,16 @@ static struct mm_struct *find_mm_struct(pid_t pid, nodemask_t *mem_nodes)
return ERR_PTR(-ESRCH);
}
get_task_struct(task);
+ rcu_read_unlock();
/*
* Check if this process has the right to modify the specified
* process. Use the regular "ptrace_may_access()" checks.
*/
if (!ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS)) {
- rcu_read_unlock();
mm = ERR_PTR(-EPERM);
goto out;
}
- rcu_read_unlock();
mm = ERR_PTR(security_task_movememory(task));
if (IS_ERR(mm))
--
2.23.0
Powered by blists - more mailing lists