From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: Oleg Nesterov <oleg@redhat.com>, Davidlohr Bueso <dave@stgolabs.net>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file()
Date: Tue, 24 Mar 2015 20:13:31 +0300 [thread overview]
Message-ID: <55119B3B.5020403@yandex-team.ru> (raw)
In-Reply-To: <20150323191055.GA10212@redhat.com>
On 23.03.2015 22:10, Oleg Nesterov wrote:
> On 03/23, Davidlohr Bueso wrote:
>>
>> void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
>> {
>> struct file *old_exe_file = rcu_dereference_protected(mm->exe_file,
>> - !atomic_read(&mm->mm_users) || current->in_execve ||
>> - lock_is_held(&mm->mmap_sem));
>> + !atomic_read(&mm->mm_users) || current->in_execve);
>
> Thanks, looks correct at first glance...
>
> But can't we remove the ->in_execve check above? and check
>
> atomic_read(&mm->mm_users) <= 1
>
> instead. OK, this is subjective, I won't insist. Just current->in_execve
> looks a bit confusing, it means "I swear, the caller is flush_old_exec()
> and this mm is actualy bprm->mm".
>
> "atomic_read(&mm->mm_users) <= 1" looks a bit more "safe". But again,
> I won't insist.
Not so safe: this will race with get_task_mm().
A lot of proc files grab temporary reference to task mm.
But this just a debug -- we can place here "true".
>
> Oleg.
>
--
Konstantin
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: Oleg Nesterov <oleg@redhat.com>, Davidlohr Bueso <dave@stgolabs.net>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file()
Date: Tue, 24 Mar 2015 20:13:31 +0300 [thread overview]
Message-ID: <55119B3B.5020403@yandex-team.ru> (raw)
In-Reply-To: <20150323191055.GA10212@redhat.com>
On 23.03.2015 22:10, Oleg Nesterov wrote:
> On 03/23, Davidlohr Bueso wrote:
>>
>> void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
>> {
>> struct file *old_exe_file = rcu_dereference_protected(mm->exe_file,
>> - !atomic_read(&mm->mm_users) || current->in_execve ||
>> - lock_is_held(&mm->mmap_sem));
>> + !atomic_read(&mm->mm_users) || current->in_execve);
>
> Thanks, looks correct at first glance...
>
> But can't we remove the ->in_execve check above? and check
>
> atomic_read(&mm->mm_users) <= 1
>
> instead. OK, this is subjective, I won't insist. Just current->in_execve
> looks a bit confusing, it means "I swear, the caller is flush_old_exec()
> and this mm is actualy bprm->mm".
>
> "atomic_read(&mm->mm_users) <= 1" looks a bit more "safe". But again,
> I won't insist.
Not so safe: this will race with get_task_mm().
A lot of proc files grab temporary reference to task mm.
But this just a debug -- we can place here "true".
>
> Oleg.
>
--
Konstantin
next prev parent reply other threads:[~2015-03-24 17:13 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-20 14:47 [PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file() Konstantin Khlebnikov
2015-03-20 14:47 ` Konstantin Khlebnikov
2015-03-23 18:11 ` Davidlohr Bueso
2015-03-23 18:11 ` Davidlohr Bueso
2015-03-23 19:10 ` Oleg Nesterov
2015-03-23 19:10 ` Oleg Nesterov
2015-03-24 14:38 ` Davidlohr Bueso
2015-03-24 14:38 ` Davidlohr Bueso
2015-03-24 17:13 ` Konstantin Khlebnikov [this message]
2015-03-24 17:13 ` Konstantin Khlebnikov
2015-03-24 18:10 ` Oleg Nesterov
2015-03-24 18:10 ` Oleg Nesterov
2015-03-24 18:15 ` Konstantin Khlebnikov
2015-03-24 18:15 ` Konstantin Khlebnikov
2015-03-24 19:02 ` Oleg Nesterov
2015-03-24 19:02 ` Oleg Nesterov
2015-03-25 1:30 ` [PATCH v2] prctl: avoid using mmap_sem for exe_file serialization Davidlohr Bueso
2015-03-25 1:30 ` Davidlohr Bueso
2015-03-25 9:21 ` Konstantin Khlebnikov
2015-03-25 9:21 ` Konstantin Khlebnikov
2015-03-25 10:42 ` [PATCH v3] " Davidlohr Bueso
2015-03-25 10:42 ` Davidlohr Bueso
2015-03-25 11:08 ` Konstantin Khlebnikov
2015-03-25 11:08 ` Konstantin Khlebnikov
2015-03-25 12:50 ` Davidlohr Bueso
2015-03-25 12:50 ` Davidlohr Bueso
2015-03-25 12:53 ` Oleg Nesterov
2015-03-25 12:53 ` Oleg Nesterov
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=55119B3B.5020403@yandex-team.ru \
--to=khlebnikov@yandex-team.ru \
--cc=akpm@linux-foundation.org \
--cc=dave@stgolabs.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=oleg@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.