linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: "ying.huang@intel.com" <ying.huang@intel.com>,
	<akpm@linux-foundation.org>
Cc: <mike.kravetz@oracle.com>, <shy828301@gmail.com>,
	<willy@infradead.org>, <ziy@nvidia.com>, <minchan@kernel.org>,
	<apopple@nvidia.com>, <dave.hansen@linux.intel.com>,
	<o451686892@gmail.com>, <jhubbard@nvidia.com>,
	<peterx@redhat.com>, <naoya.horiguchi@nec.com>, <mhocko@suse.com>,
	<riel@redhat.com>, <osalvador@suse.de>, <david@redhat.com>,
	<sfr@canb.auug.org.au>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] mm/migration: reduce the rcu lock duration
Date: Tue, 12 Apr 2022 11:21:31 +0800	[thread overview]
Message-ID: <34f3aff7-0111-a8d6-a559-92bf6d0bd62a@huawei.com> (raw)
In-Reply-To: <557be6cc7ecdee357391df3fe94e5573f9e1746d.camel@intel.com>

On 2022/4/12 10:07, ying.huang@intel.com wrote:
> On Sat, 2022-04-09 at 15:38 +0800, Miaohe Lin wrote:
>> 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.
>>
>> Reviewed-by: Muchun Song <songmuchun@bytedance.com>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>>  mm/migrate.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/mm/migrate.c b/mm/migrate.c
>> index a3d8c2be2631..d8aae6c75990 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))
> 
> Why do you ignore our discussion for the previous version?
> 
> https://lore.kernel.org/linux-mm/8735ju7as9.fsf@yhuang6-desk2.ccr.corp.intel.com/
> 

Sorry for confusing. I remember this patch is pending for verify. The reason I post this series is that
I want to move the other patches in this series forward while this patch is still pending for verify.

Thanks.

> Best Regards,
> Huang, Ying
> 
> 
> .
> 



  reply	other threads:[~2022-04-12  3:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-09  7:38 [PATCH 0/4] A few cleanup and fixup patches for migration Miaohe Lin
2022-04-09  7:38 ` [PATCH 1/4] mm/migration: reduce the rcu lock duration Miaohe Lin
2022-04-11 14:09   ` Christoph Hellwig
2022-04-12  2:07   ` ying.huang
2022-04-12  3:21     ` Miaohe Lin [this message]
2022-04-09  7:38 ` [PATCH 2/4] mm/migration: remove unneeded lock page and PageMovable check Miaohe Lin
2022-04-11 14:09   ` Christoph Hellwig
2022-04-09  7:38 ` [PATCH 3/4] mm/migration: return errno when isolate_huge_page failed Miaohe Lin
2022-04-11 14:10   ` Christoph Hellwig
2022-04-12  3:13     ` Miaohe Lin
2022-04-09  7:38 ` [PATCH 4/4] mm/migration: fix potential pte_unmap on an not mapped pte Miaohe Lin
2022-04-09 11:38   ` kernel test robot
2022-04-11  1:54     ` Miaohe Lin
2022-04-11 11:41   ` David Hildenbrand
2022-04-12  2:55     ` Miaohe Lin
2022-04-12  2:25 ` [PATCH 0/4] A few cleanup and fixup patches for migration ying.huang
2022-04-12  3:29   ` Miaohe Lin
2022-04-12  6:33     ` ying.huang
2022-04-12  8:59       ` Miaohe Lin
2022-04-12  7:00     ` ying.huang
2022-04-12  9:06       ` Miaohe Lin

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=34f3aff7-0111-a8d6-a559-92bf6d0bd62a@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mike.kravetz@oracle.com \
    --cc=minchan@kernel.org \
    --cc=naoya.horiguchi@nec.com \
    --cc=o451686892@gmail.com \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.com \
    --cc=riel@redhat.com \
    --cc=sfr@canb.auug.org.au \
    --cc=shy828301@gmail.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=ziy@nvidia.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;
as well as URLs for NNTP newsgroup(s).