linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, Hugh Dickins <hughd@google.com>,
	William Kucharski <william.kucharski@oracle.com>
Subject: Re: [PATCH v2] page cache: Store only head pages in i_pages
Date: Thu, 14 Feb 2019 14:25:44 -0800	[thread overview]
Message-ID: <20190214222544.GG12668@bombadil.infradead.org> (raw)
In-Reply-To: <20190214220344.2ovvzwcfuxxehzzt@kshutemo-mobl1>

On Fri, Feb 15, 2019 at 01:03:44AM +0300, Kirill A. Shutemov wrote:
> > +		/*
> > +		 * A page got inserted in our range? Skip it. We have our
> > +		 * pages locked so they are protected from being removed.
> > +		 */
> > +		if (page != pvec->pages[i]) {
> 
> Maybe a comment for the VM_BUG while you're there?

Great idea.  I didn't understand it the first time I looked at it either,
but I forgot to write a comment when I figured it out.

                /*
                 * A page got inserted in our range? Skip it. We have our
                 * pages locked so they are protected from being removed.
+                * If we see a page whose index is higher than ours, it
+                * means our page has been removed, which shouldn't be
+                * possible because we're holding the PageLock.
                 */
                if (page != pvec->pages[i]) {

> > +		/* Leave page->index set: truncation lookup relies on it */
> > +
> > +		if (page->index + (1UL << compound_order(page)) - 1 ==
> > +				xas.xa_index)
> 
> It's 1am here and I'm slow, but it took me few minutes to understand how
> it works. Please add a comment.

I should get you to review at 1am more often!  You're quite right.
Sleep-deprived Kirill spots problems that normal people would encounter.


                /* Leave page->index set: truncation lookup relies on it */
 
+               /*
+                * Move to the next page in the vector if this is a small page
+                * or the index is of the last page in this compound page).
+                */
                if (page->index + (1UL << compound_order(page)) - 1 ==
                                xas.xa_index)
                        i++;


Thanks for the review.

  reply	other threads:[~2019-02-14 22:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12 18:34 [PATCH v2] page cache: Store only head pages in i_pages Matthew Wilcox
2019-02-13 14:41 ` Jan Kara
2019-02-13 20:17   ` Matthew Wilcox
2019-02-14 16:27     ` Jan Kara
2019-02-14 13:30 ` Kirill A. Shutemov
2019-02-14 20:53   ` Matthew Wilcox
2019-02-14 22:03     ` Kirill A. Shutemov
2019-02-14 22:25       ` Matthew Wilcox [this message]
2019-02-14 21:17   ` Matthew Wilcox
2019-02-14 22:08     ` Kirill A. Shutemov
2019-02-14 22:11       ` Matthew Wilcox
2019-02-14 22:29         ` Kirill A. Shutemov
2019-02-14 22:29   ` Kirill A. Shutemov
2019-02-15 20:28     ` Matthew Wilcox
2019-02-14 22:41   ` Kirill A. Shutemov
2019-02-15 20:20     ` Matthew Wilcox
2019-02-15 21:17       ` Kirill A. Shutemov

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=20190214222544.GG12668@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=hughd@google.com \
    --cc=kirill@shutemov.name \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=william.kucharski@oracle.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;
as well as URLs for NNTP newsgroup(s).