Re: [PATCH v2] page cache: Store only head pages in i_pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux