linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michel Lespinasse <walken@google.com>
To: Bob Liu <lliubbo@gmail.com>
Cc: akpm@linux-foundation.org, fengguang.wu@intel.com,
	linux-mm@kvack.org, kenchen@google.com
Subject: Re: [PATCH 2/2] clean up set_page_dirty()
Date: Sun, 14 Nov 2010 04:05:56 -0800	[thread overview]
Message-ID: <AANLkTikmg_Uiu4bP-U05wbCJnPo5Xt=qxSB+45Oq=5en@mail.gmail.com> (raw)
In-Reply-To: <1289379628-14044-2-git-send-email-lliubbo@gmail.com>

On Wed, Nov 10, 2010 at 1:00 AM, Bob Liu <lliubbo@gmail.com> wrote:
> Use TestSetPageDirty() to clean up set_page_dirty().
>
> Signed-off-by: Bob Liu <lliubbo@gmail.com>
> ---
>  mm/page-writeback.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index e8f5f06..da86224 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -1268,11 +1268,8 @@ int set_page_dirty(struct page *page)
>  #endif
>                return (*spd)(page);
>        }
> -       if (!PageDirty(page)) {
> -               if (!TestSetPageDirty(page))
> -                       return 1;
> -       }
> -       return 0;
> +
> +       return !TestSetPageDirty(page);
>  }
>  EXPORT_SYMBOL(set_page_dirty);

TestSetPageDirty compiles to a locked bts instruction (on x86). This
will acquire the cache line for exclusive access, even when the bit is
already set. I think this is why we have an extra if
(!PageDirty(page)) test - we don't want to cause cache coherency
overhead if the page is already dirty.

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

--
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>

  parent reply	other threads:[~2010-11-14 12:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10  9:00 [PATCH 1/2] fix __set_page_dirty_no_writeback() return value Bob Liu
2010-11-10  9:00 ` [PATCH 2/2] clean up set_page_dirty() Bob Liu
2010-11-10 21:04   ` Andrew Morton
2010-11-14 12:05   ` Michel Lespinasse [this message]
2010-11-10 21:01 ` [PATCH 1/2] fix __set_page_dirty_no_writeback() return value Andrew Morton

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='AANLkTikmg_Uiu4bP-U05wbCJnPo5Xt=qxSB+45Oq=5en@mail.gmail.com' \
    --to=walken@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=kenchen@google.com \
    --cc=linux-mm@kvack.org \
    --cc=lliubbo@gmail.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