linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <ooo@electrozaur.com>
To: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Benny Halevy <bhalevy@primarydata.com>,
	Trond Myklebust <trond.myklebust@primarydata.com>,
	Christoph Lameter <cl@linux.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-nfs@vger.kernel.org, linux-mm@kvack.org,
	osd-dev@open-osd.org
Subject: Re: [PATCH] osd fs: __r4w_get_page rely on PageUptodate for uptodate
Date: Sun, 01 Nov 2015 12:00:20 +0200	[thread overview]
Message-ID: <5635E2B4.5070308@electrozaur.com> (raw)
In-Reply-To: <alpine.LSU.2.11.1510291137430.3369@eggly.anvils>

On 10/29/2015 08:43 PM, Hugh Dickins wrote:
> Patch "mm: migrate dirty page without clear_page_dirty_for_io etc",
> presently staged in mmotm and linux-next, simplifies the migration of
> a PageDirty pagecache page: one stat needs moving from zone to zone
> and that's about all.
> 
> It's convenient and safest for it to shift the PageDirty bit from old
> page to new, just before updating the zone stats: before copying data
> and marking the new PageUptodate.  This is all done while both pages
> are isolated and locked, just as before; and just as before, there's
> a moment when the new page is visible in the radix_tree, but not yet
> PageUptodate.  What's new is that it may now be briefly visible as
> PageDirty before it is PageUptodate.
> 
> When I scoured the tree to see if this could cause a problem anywhere,
> the only places I found were in two similar functions __r4w_get_page():
> which look up a page with find_get_page() (not using page lock), then
> claim it's uptodate if it's PageDirty or PageWriteback or PageUptodate.
> 
> I'm not sure whether that was right before, but now it might be wrong
> (on rare occasions): only claim the page is uptodate if PageUptodate.
> Or perhaps the page in question could never be migratable anyway?
> 

Hi Sir Hugh

I'm sorry, I admit the code is clear as mud, but your patch below is wrong.

The *uptodate return from __r4w_get_page is not really "up-to-date" at all
actually it means: "do we need to read the page from storage" writable/dirty pages
we do not read from storage but use the newest data in memory.

r4w means read-for-write which is when we need to bring in the full stripe to
re-calculate raid5/6 . (when only the partial stripe is written)

The scenario below of: "briefly visible as PageDirty before it is PageUptodate"
is fine in this case because in both cases we do not need to read the page.

Thanks for looking
Boaz

> Signed-off-by: Hugh Dickins <hughd@google.com>

This patch is not correct!

> ---
> 
>  fs/exofs/inode.c             |    5 +----
>  fs/nfs/objlayout/objio_osd.c |    5 +----
>  2 files changed, 2 insertions(+), 8 deletions(-)
> 
> --- 4.3-next/fs/exofs/inode.c	2015-08-30 11:34:09.000000000 -0700
> +++ linux/fs/exofs/inode.c	2015-10-28 16:55:18.795554294 -0700
> @@ -592,10 +592,7 @@ static struct page *__r4w_get_page(void
>  			}
>  			unlock_page(page);
>  		}
> -		if (PageDirty(page) || PageWriteback(page))
> -			*uptodate = true;
> -		else
> -			*uptodate = PageUptodate(page);
> +		*uptodate = PageUptodate(page);
>  		EXOFS_DBGMSG2("index=0x%lx uptodate=%d\n", index, *uptodate);
>  		return page;
>  	} else {
> --- 4.3-next/fs/nfs/objlayout/objio_osd.c	2015-10-21 18:35:07.620645439 -0700
> +++ linux/fs/nfs/objlayout/objio_osd.c	2015-10-28 16:53:55.083686639 -0700
> @@ -476,10 +476,7 @@ static struct page *__r4w_get_page(void
>  		}
>  		unlock_page(page);
>  	}
> -	if (PageDirty(page) || PageWriteback(page))
> -		*uptodate = true;
> -	else
> -		*uptodate = PageUptodate(page);
> +	*uptodate = PageUptodate(page);
>  	dprintk("%s: index=0x%lx uptodate=%d\n", __func__, index, *uptodate);
>  	return page;
>  }
> 

--
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-11-01 10:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29 18:43 Hugh Dickins
2015-11-01 10:00 ` Boaz Harrosh [this message]
2015-11-01 23:39   ` Hugh Dickins
2015-11-02 11:05     ` Boaz Harrosh
2015-11-03  2:49       ` Hugh Dickins
2015-11-03  9:24         ` Boaz Harrosh
2015-11-03 15:39           ` 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=5635E2B4.5070308@electrozaur.com \
    --to=ooo@electrozaur.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhalevy@primarydata.com \
    --cc=cl@linux.com \
    --cc=hughd@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=osd-dev@open-osd.org \
    --cc=trond.myklebust@primarydata.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