linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: isolate_lru_page on !head pages
Date: Wed, 9 Dec 2015 14:02:05 +0100	[thread overview]
Message-ID: <20151209130204.GD30907@dhcp22.suse.cz> (raw)

Hi Kirill,
while looking at the issue reported by Minchan [1] I have noticed that
there is nothing to prevent from "isolating" a tail page from LRU because
isolate_lru_page checks PageLRU which is
PAGEFLAG(LRU, lru, PF_HEAD)
so it is checked on the head page rather than the given page directly
but the rest of the operation is done on the given (tail) page.

This is really subtle because this expects that every caller of this
function checks for the tail page otherwise we would clobber statistics
and who knows what else (I haven't checked that in detail) as the page
cannot be on the LRU list and the operation makes sense only on the head
page.

Would it make more sense to make PageLRU PF_ANY? That would return
false for PageLRU on any tail page and so it would be ignored by
isolate_lru_page.

I haven't checked other flags but there might be a similar situation. I
am wondering whether it is really a good idea to perform a flag check on
a different page then the operation which depends on the result of the
test in general. It sounds like a maintenance horror to me.

[1] http://lkml.kernel.org/r/20151201133455.GB27574@bbox
-- 
Michal Hocko
SUSE Labs

--
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>

             reply	other threads:[~2015-12-09 13:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 13:02 Michal Hocko [this message]
2015-12-14 12:04 ` isolate_lru_page on !head pages Kirill A. Shutemov
2015-12-15  8:52   ` Michal Hocko
2015-12-15 12:03     ` Kirill A. Shutemov
2015-12-15 16:59       ` Michal Hocko
2015-12-22 15:47         ` Vlastimil Babka

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=20151209130204.GD30907@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).