From: Robin Holt <holt@sgi.com>
To: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Robin Holt <holt@sgi.com>, Ingo Molnar <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Pallipadi, Venkatesh" <venkatesh.pallipadi@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: [Patch] x86,pat Update the page flags for memtype atomically instead of using memtype_lock.
Date: Mon, 15 Mar 2010 16:11:36 -0500 [thread overview]
Message-ID: <20100315211136.GD4920@sgi.com> (raw)
In-Reply-To: <1268439313.2793.148.camel@sbs-t61.sc.intel.com>
> > static inline void set_page_memtype(struct page *pg, unsigned long memtype)
> > {
> > + unsigned long memtype_flags = _PGMT_DEFAULT;
> > + unsigned long old_flags;
> > + unsigned long new_flags;
> > +
> > switch (memtype) {
> > case _PAGE_CACHE_WC:
> > - ClearPageUncached(pg);
> > - SetPageWC(pg);
> > + memtype_flags = _PGMT_WC;
> > break;
> > case _PAGE_CACHE_UC_MINUS:
> > - SetPageUncached(pg);
> > - ClearPageWC(pg);
> > + memtype_flags = _PGMT_UC_MINUS;
> > break;
> > case _PAGE_CACHE_WB:
> > - SetPageUncached(pg);
> > - SetPageWC(pg);
> > - break;
> > - default:
> > - case -1:
> > - ClearPageUncached(pg);
> > - ClearPageWC(pg);
> > + memtype_flags = _PGMT_WB;
>
> For WB case it should be _PGMT_WB and for the case of "-1" this should
> be _PGMT_DEFAULT, as in the case of free page we mark it _PGMT_DEFAULT
> and when there is an explicit request to mark it WB, then we mark it
> _PGMT_WB
>
> Other than that it looks good to me.
This is easier to look at if you ignore the diff and just look at the
fixed up code:
static inline void set_page_memtype(struct page *pg, unsigned long memtype)
{
unsigned long memtype_flags = _PGMT_DEFAULT;
unsigned long old_flags;
unsigned long new_flags;
switch (memtype) {
case _PAGE_CACHE_WC:
memtype_flags = _PGMT_WC;
break;
case _PAGE_CACHE_UC_MINUS:
memtype_flags = _PGMT_UC_MINUS;
break;
case _PAGE_CACHE_WB:
memtype_flags = _PGMT_WB;
break;
}
do {
old_flags = pg->flags;
new_flags = (old_flags & _PGMT_CLEAR_MASK) | memtype_flags;
} while (cmpxchg(&pg->flags, old_flags, new_flags) != old_flags);
}
The memtype_flags start out cleared and only deviate when _WC, _UC_MINUS,
or _WB is specified.
Did I miss anything there?
Thanks,
Robin
prev parent reply other threads:[~2010-03-15 21:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-11 16:17 [Patch] x86,pat Update the page flags for memtype atomically instead of using memtype_lock Robin Holt
2010-03-13 0:15 ` Suresh Siddha
2010-03-13 1:08 ` Thomas Gleixner
2010-03-13 1:46 ` Suresh Siddha
2010-03-13 1:52 ` Thomas Gleixner
2010-03-13 2:05 ` Suresh Siddha
2010-03-15 21:11 ` Robin Holt [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=20100315211136.GD4920@sgi.com \
--to=holt@sgi.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
--cc=venkatesh.pallipadi@gmail.com \
--cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.