From: Hugh Dickins <hughd@google.com>
To: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Minchan Kim <minchan.kim@gmail.com>,
Rik van Riel <riel@redhat.com>, Shaohua Li <shaohua.li@intel.com>,
Eric Dumazet <eric.dumazet@gmail.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Michel Lespinasse <walken@google.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 2/2] SHM_UNLOCK: fix Unevictable pages stranded after swap
Date: Mon, 9 Jan 2012 15:56:36 -0800 (PST) [thread overview]
Message-ID: <alpine.LSU.2.00.1201091546450.1778@eggly.anvils> (raw)
In-Reply-To: <4F0B73AC.7000504@gmail.com>
On Mon, 9 Jan 2012, KOSAKI Motohiro wrote:
> (1/9/12 5:25 PM), Hugh Dickins wrote:
> > On Mon, 9 Jan 2012, KOSAKI Motohiro wrote:
> >
> > > PG_mlocked operation is not protected by LRU lock. So, I think we
> >
> > Right. But I don't see that I've made a significant change there.
> >
> > I may be being lazy, and rushing back to answer you, without giving
> > constructive thought to what the precise race is that you see, and
> > how we might fix it. If the case you have in mind is easy for you
> > to describe in detail, please do so; but don't hesitate to tell me
> > to my own work for myself!
>
> Bah! I was moron. I now think your code is right.
>
> spin_lock(lru_lock)
> if (page_evictable(page))
> blah blah blah
> spin_unlock(lru_lock)
>
> is always safe. Counter part should have following code and
> waiting spin_lock(lru_lock) in isolate_lru_page().
>
> if (!isolate_lru_page(page))
> putback_lru_page(page);
>
> then, even if check_move_unevictable_pages() observed wrong page status,
> putback_lru_page() should put back the page into right lru.
>
> I'm very sorry for annoying you.
Far from it, thank you again for giving it serious thought.
I am not going to pretend to have thought down these paths myself,
not recently - I was just relying on not changing the behaviour.
But I am reassured to know that you have worked through it again
and are now satisfied.
>
> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Thank you.
>
> Probably, page_evictable() might be needed some additional comments. But
> I have no idea what comment clearly explain this complex rule.....
I don't know any language that can make it clear: when forced to,
one just has to think through it back and forth by oneself; and
even then, it's so quickly forgotten.
Hugh
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-01-09 23:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-06 21:10 [PATCH 1/2] SHM_UNLOCK: fix long unpreemptible section Hugh Dickins
2012-01-06 21:12 ` [PATCH 2/2] SHM_UNLOCK: fix Unevictable pages stranded after swap Hugh Dickins
2012-01-09 20:42 ` KOSAKI Motohiro
2012-01-09 22:25 ` Hugh Dickins
2012-01-09 23:09 ` KOSAKI Motohiro
2012-01-09 23:56 ` Hugh Dickins [this message]
2012-01-15 0:20 ` Hugh Dickins
2012-01-07 8:28 ` [PATCH 1/2] SHM_UNLOCK: fix long unpreemptible section KOSAKI Motohiro
2012-01-15 0:18 ` Hugh Dickins
2012-01-18 22:37 ` Andrew Morton
2012-01-18 23:26 ` Hugh Dickins
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=alpine.LSU.2.00.1201091546450.1778@eggly.anvils \
--to=hughd@google.com \
--cc=akpm@linux-foundation.org \
--cc=eric.dumazet@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=kosaki.motohiro@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan.kim@gmail.com \
--cc=riel@redhat.com \
--cc=shaohua.li@intel.com \
--cc=walken@google.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