linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan.kim@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Linus <torvalds@linux-foundation.org>
Subject: Re: linux-next: manual merge of the cleancache tree with Linus' tree
Date: Thu, 24 Mar 2011 14:38:10 +0900	[thread overview]
Message-ID: <AANLkTikagME334Y6PH4P_Nybf_h=fov5CiNBAY7KxYyN@mail.gmail.com> (raw)
In-Reply-To: <20110323205615.6984f974.akpm@linux-foundation.org>

On Thu, Mar 24, 2011 at 12:56 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Thu, 24 Mar 2011 13:55:24 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
>> Hi Dan,
>>
>> Today's linux-next merge of the cleancache tree got a conflict in
>> mm/truncate.c between commit 5adc7b518b54 ("mm: truncate: change
>> remove_from_page_cache") from Linus' tree and commit 03e838947c8a
>> ("mm/fs: add hooks to support cleancache") from the cleancache tree.
>>
>> I fixed it up (see below) but am really not sure of the fix.  I can carry
>> this fix as necessary.
>>
>> Is this stuff going to be merged into Linus' tree this time round?
>> --
>> Cheers,
>> Stephen Rothwell                    sfr@canb.auug.org.au
>>
>> diff --cc mm/truncate.c
>> index a956675,cd94607..0000000
>> --- a/mm/truncate.c
>> +++ b/mm/truncate.c
>> @@@ -106,8 -108,13 +108,12 @@@ truncate_complete_page(struct address_s
>>       cancel_dirty_page(page, PAGE_CACHE_SIZE);
>>
>>       clear_page_mlock(page);
>>  -    remove_from_page_cache(page);
>>       ClearPageMappedToDisk(page);
>>  +    delete_from_page_cache(page);
>> +     /* this must be after the remove_from_page_cache which
>> +      * calls cleancache_put_page (and note page->mapping is now NULL)
>> +      */
>> +     cleancache_flush_page(mapping, page);
>>  -    page_cache_release(page);       /* pagecache ref */
>>       return 0;
>>   }
>
> I did the cleancache_flush_page() before the delete_from_page_cache(),
> in case the delete_from_page_cache() freed the page.  I didn't actually
> check whether that makes sense though.

I am not sure cleancache's put and flush semantic.
If I understand rightly with old __remove_from_page_cache's comment,
maybe cleancache_flush_page is to invalidate the page.(If I understand
right, I hope the name is changed to cleancache_invalidate_page)

"        /*
         * if we're uptodate, flush out into the cleancache, otherwise
         * invalidate any existing cleancache entries.  We can't leave
         * stale data around in the cleancache once our page is gone
         */
        if (PageUptodate(page))
                cleancache_put_page(page);
        else
                cleancache_flush_page(mapping, page); "

So I think cleancache_flush_page should be done after
delete_from_page_cache because delete_from_page_cache calls
cleancache_put_page(maybe this function would flush the content of
memory into cleancache's target) before we invalidates the page.

And it should not be a problem in case the delete_from_page_cache
freed the page since cleancache should have a reference the page but I
didn't check cleancahe always has a reference of page. If it isn't,
it's a critical problem.

Dan, Could you comment this?


-- 
Kind regards,
Minchan Kim

  reply	other threads:[~2011-03-24  5:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24  2:55 linux-next: manual merge of the cleancache tree with Linus' tree Stephen Rothwell
2011-03-24  3:56 ` Andrew Morton
2011-03-24  5:38   ` Minchan Kim [this message]
2011-03-24  5:58     ` Minchan Kim
2011-03-24  6:42       ` Andrew Morton
2011-03-24 15:37       ` Dan Magenheimer
2011-04-14 21:04     ` Dan Magenheimer
  -- strict thread matches above, loose matches on Subject: below --
2011-02-14  6:17 Stephen Rothwell
2011-01-15  1:44 Stephen Rothwell
2011-01-14  1:12 Stephen Rothwell

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='AANLkTikagME334Y6PH4P_Nybf_h=fov5CiNBAY7KxYyN@mail.gmail.com' \
    --to=minchan.kim@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.magenheimer@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=torvalds@linux-foundation.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).