From: Suren Baghdasaryan <surenb@google.com>
To: xf2017140389@gmail.com
Cc: akpm@linux-foundation.org, christian@brauner.io,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
zhangcang@xiaomi.com, wangju@xiaomi.com, fangzhirong@xiaomi.com,
xiaofeng <xiaofeng5@xiaomi.com>,
Minchan Kim <minchan@kernel.org>
Subject: Re: [PATCH] mm/madvise: break reclaim when lock race
Date: Tue, 7 Dec 2021 09:04:47 -0800 [thread overview]
Message-ID: <CAJuCfpFgEB0qNcQGhi+wyrx4ktwm+PZujLeKTUeEMZTRUL=31w@mail.gmail.com> (raw)
In-Reply-To: <20211207032202.6022-1-xiaofeng5@xiaomi.com>
On Mon, Dec 6, 2021 at 7:22 PM <xf2017140389@gmail.com> wrote:
>
> From: xiaofeng <xiaofeng5@xiaomi.com>
>
> When the process_madvise() system call is being used, it takes mmap_lock and blocks the application from allocating memory, leading to unreasonable delays. This patchset aims to fix it.
Please use checkpatch.pl script before posting (see this blog for
example: http://nickdesaulniers.github.io/blog/2017/05/16/submitting-your-first-patch-to-the-linux-kernel-and-responding-to-feedback/).
Could you please describe your usecase a bit more? Which MADV is being
used specifically (MADV_COLD or MADV_PAGEOUT)?
CC'ing Minchan as he might be interested in learning more about this.
>
> Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
> ---
> mm/madvise.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/mm/madvise.c b/mm/madvise.c
> index 8c927202bbe6..8f1e325873e0 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -322,6 +322,9 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd,
> if (fatal_signal_pending(current))
> return -EINTR;
>
> + if (mmap_lock_is_contended(mm))
> + return -EINTR;
> +
> #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> if (pmd_trans_huge(*pmd)) {
> pmd_t orig_pmd;
> --
> 2.17.1
>
next prev parent reply other threads:[~2021-12-07 17:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-07 3:22 xf2017140389
2021-12-07 17:04 ` Suren Baghdasaryan [this message]
2021-12-07 17:20 ` Matthew Wilcox
-- strict thread matches above, loose matches on Subject: below --
2021-12-06 14:55 xf2017140389
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='CAJuCfpFgEB0qNcQGhi+wyrx4ktwm+PZujLeKTUeEMZTRUL=31w@mail.gmail.com' \
--to=surenb@google.com \
--cc=akpm@linux-foundation.org \
--cc=christian@brauner.io \
--cc=fangzhirong@xiaomi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=wangju@xiaomi.com \
--cc=xf2017140389@gmail.com \
--cc=xiaofeng5@xiaomi.com \
--cc=zhangcang@xiaomi.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