From: Michal Hocko <mhocko@kernel.org>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Cyrill Gorcunov <gorcunov@gmail.com>,
Kirill Tkhai <ktkhai@virtuozzo.com>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH 1/5] proc: use down_read_killable for /proc/pid/maps
Date: Fri, 17 May 2019 14:41:19 +0200 [thread overview]
Message-ID: <20190517124119.GA1825@dhcp22.suse.cz> (raw)
In-Reply-To: <155790967258.1319.11531787078240675602.stgit@buzz>
On Wed 15-05-19 11:41:12, Konstantin Khlebnikov wrote:
> Do not stuck forever if something wrong.
> This function also used for /proc/pid/smaps.
I do agree that the killable variant is better but I do not understand
the changelog. What would keep the lock blocked for ever? I do not think
we have writer lock held for unbound amount of time anywhere, do we?
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Other than that
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> fs/proc/task_mmu.c | 6 +++++-
> fs/proc/task_nommu.c | 6 +++++-
> 2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index 01d4eb0e6bd1..2bf210229daf 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -166,7 +166,11 @@ static void *m_start(struct seq_file *m, loff_t *ppos)
> if (!mm || !mmget_not_zero(mm))
> return NULL;
>
> - down_read(&mm->mmap_sem);
> + if (down_read_killable(&mm->mmap_sem)) {
> + mmput(mm);
> + return ERR_PTR(-EINTR);
> + }
> +
> hold_task_mempolicy(priv);
> priv->tail_vma = get_gate_vma(mm);
>
> diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
> index 36bf0f2e102e..7907e6419e57 100644
> --- a/fs/proc/task_nommu.c
> +++ b/fs/proc/task_nommu.c
> @@ -211,7 +211,11 @@ static void *m_start(struct seq_file *m, loff_t *pos)
> if (!mm || !mmget_not_zero(mm))
> return NULL;
>
> - down_read(&mm->mmap_sem);
> + if (down_read_killable(&mm->mmap_sem)) {
> + mmput(mm);
> + return ERR_PTR(-EINTR);
> + }
> +
> /* start from the Nth VMA */
> for (p = rb_first(&mm->mm_rb); p; p = rb_next(p))
> if (n-- == 0)
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2019-05-17 12:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 8:41 Konstantin Khlebnikov
2019-05-15 8:41 ` [PATCH 2/5] proc: use down_read_killable for /proc/pid/smaps_rollup Konstantin Khlebnikov
2019-05-17 12:45 ` Michal Hocko
2019-06-09 9:07 ` Konstantin Khlebnikov
2019-06-10 18:58 ` Michal Hocko
2019-05-15 8:41 ` [PATCH 3/5] proc: use down_read_killable for /proc/pid/pagemap Konstantin Khlebnikov
2019-05-17 12:46 ` Michal Hocko
2019-05-15 8:41 ` [PATCH 4/5] proc: use down_read_killable for /proc/pid/clear_refs Konstantin Khlebnikov
2019-05-17 12:47 ` Michal Hocko
2019-05-15 8:41 ` [PATCH 5/5] proc: use down_read_killable for /proc/pid/map_files Konstantin Khlebnikov
2019-05-15 17:00 ` Roman Gushchin
2019-05-15 9:05 ` [PATCH 1/5] proc: use down_read_killable for /proc/pid/maps Cyrill Gorcunov
2019-05-15 9:16 ` Kirill Tkhai
2019-05-17 12:41 ` Michal Hocko [this message]
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=20190517124119.GA1825@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=gorcunov@gmail.com \
--cc=khlebnikov@yandex-team.ru \
--cc=ktkhai@virtuozzo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=viro@zeniv.linux.org.uk \
/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