From: Bob Liu <lliubbo@gmail.com>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"kenchen@google.com" <kenchen@google.com>
Subject: Re: [PATCH v2] fix __set_page_dirty_no_writeback() return value
Date: Thu, 11 Nov 2010 15:17:12 +0800 [thread overview]
Message-ID: <AANLkTi=e5_SWequhy4RyVy1T+U9D_9WacOogV6JWomXz@mail.gmail.com> (raw)
In-Reply-To: <20101111034546.GA20299@localhost>
On Thu, Nov 11, 2010 at 11:45 AM, Wu Fengguang <fengguang.wu@intel.com> wrote:
> On Thu, Nov 11, 2010 at 11:36:48AM +0800, Bob Liu wrote:
>> On Thu, Nov 11, 2010 at 11:26 AM, Wu Fengguang <fengguang.wu@intel.com> wrote:
>> > On Thu, Nov 11, 2010 at 11:05:54AM +0800, Bob Liu wrote:
>> >> __set_page_dirty_no_writeback() should return true if it actually transitioned
>> >> the page from a clean to dirty state although it seems nobody used its return
>> >> value now.
>> >>
>> >> Change from v1:
>> >> * preserving cacheline optimisation as Andrew pointed out
>> >>
>> >> Signed-off-by: Bob Liu <lliubbo@gmail.com>
>> >> ---
>> >> mm/page-writeback.c | 4 +++-
>> >> 1 files changed, 3 insertions(+), 1 deletions(-)
>> >>
>> >> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
>> >> index bf85062..ac7018a 100644
>> >> --- a/mm/page-writeback.c
>> >> +++ b/mm/page-writeback.c
>> >> @@ -1157,8 +1157,10 @@ EXPORT_SYMBOL(write_one_page);
>> >> */
>> >> int __set_page_dirty_no_writeback(struct page *page)
>> >> {
>> >> - if (!PageDirty(page))
>> >> + if (!PageDirty(page)) {
>> >> SetPageDirty(page);
>> >> + return 1;
>> >> + }
>> >> return 0;
>> >> }
>> >
>> > It's still racy if not using TestSetPageDirty(). In fact
>> > set_page_dirty() has a default reference implementation:
>>
>> Yes, Andrew had also pointed out that. And I have send v3 fix this.
>> Could you ack it?
>
> Acked-by: Wu Fengguang <fengguang.wu@intel.com>
>
Thanks.
> Thanks!
>
>> >
>> > if (!PageDirty(page)) {
>> > if (!TestSetPageDirty(page))
>> > return 1;
>>
>> return !TestSetPageDirty(page) is more simply?
>
> Yeah that's fine.
>
>> > }
>> > return 0;
>> >
>> > It seems the return value currently is only tested for doing
>> > balance_dirty_pages_ratelimited(). So not a big problem.
>> >
>>
>> yeah, all those are small changes no matter with any problem:-).
>
> It's always good to make it correct :) I looked at the users mainly to
> answer the question: is it a must fix for 2.6.37 or even 2.6.36.x?
>
I have no idea, I think either is okay since it's not related with any bug.
--
Thanks,
--Bob
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2010-11-11 7:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-11 3:05 Bob Liu
2010-11-11 3:02 ` Andrew Morton
2010-11-11 3:08 ` Bob Liu
2010-11-11 3:26 ` Wu Fengguang
2010-11-11 3:36 ` Bob Liu
2010-11-11 3:45 ` Wu Fengguang
2010-11-11 7:17 ` Bob Liu [this message]
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='AANLkTi=e5_SWequhy4RyVy1T+U9D_9WacOogV6JWomXz@mail.gmail.com' \
--to=lliubbo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=kenchen@google.com \
--cc=linux-mm@kvack.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