From: Andy Lutomirski <luto@kernel.org>
To: Nadav Amit <nadav.amit@gmail.com>
Cc: Andy Lutomirski <luto@kernel.org>, Nadav Amit <namit@vmware.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>
Subject: Re: [PATCH] mm: Prevent racy access to tlb_flush_pending
Date: Mon, 17 Jul 2017 21:52:31 -0700 [thread overview]
Message-ID: <CALCETrW3ZtK6=-KtB5NC6SUhRujVVPeYwihj+puq9iiTcsSjOA@mail.gmail.com> (raw)
In-Reply-To: <4999C175-5C91-4DF8-98C5-350219421518@gmail.com>
On Mon, Jul 17, 2017 at 6:40 PM, Nadav Amit <nadav.amit@gmail.com> wrote:
> Andy Lutomirski <luto@kernel.org> wrote:
>
>> On Mon, Jul 17, 2017 at 11:02 AM, Nadav Amit <namit@vmware.com> wrote:
>>> Setting and clearing mm->tlb_flush_pending can be performed by multiple
>>> threads, since mmap_sem may only be acquired for read in task_numa_work.
>>> If this happens, tlb_flush_pending may be cleared while one of the
>>> threads still changes PTEs and batches TLB flushes.
>>>
>>> As a result, TLB flushes can be skipped because the indication of
>>> pending TLB flushes is lost, for instance due to race between
>>> migration and change_protection_range (just as in the scenario that
>>> caused the introduction of tlb_flush_pending).
>>>
>>> The feasibility of such a scenario was confirmed by adding assertion to
>>> check tlb_flush_pending is not set by two threads, adding artificial
>>> latency in change_protection_range() and using sysctl to reduce
>>> kernel.numa_balancing_scan_delay_ms.
>>
>> This thing is logically a refcount. Should it be refcount_t?
>
> I don’t think so. refcount_inc() would WARN_ONCE if the counter is zero
> before the increase, although this is a valid scenario here.
>
Hmm. Maybe a refcount that starts at 1? My point is that, if someone
could force it to overflow, it would be bad. Maybe this isn't worth
worrying about.
--
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>
next prev parent reply other threads:[~2017-07-18 4:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 18:02 Nadav Amit
2017-07-18 1:31 ` Andy Lutomirski
2017-07-18 1:40 ` Nadav Amit
2017-07-18 4:52 ` Andy Lutomirski [this message]
2017-07-18 5:11 ` Nadav Amit
2017-07-24 19:50 ` Nadav Amit
2017-07-24 23:54 ` Andrew Morton
2017-07-25 0:27 ` Nadav Amit
2017-07-25 0:33 ` Nadav Amit
2017-07-25 9:49 ` Mel Gorman
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='CALCETrW3ZtK6=-KtB5NC6SUhRujVVPeYwihj+puq9iiTcsSjOA@mail.gmail.com' \
--to=luto@kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=nadav.amit@gmail.com \
--cc=namit@vmware.com \
--cc=riel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox