mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org,
	Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>,
	Suresh B Siddha <suresh.b.siddha@intel.com>
Subject: Re: [PATCH 5/5 v2] x86: PAT: make pat_x_mtrr_type() more readable
Date: Wed, 18 Jun 2008 17:28:16 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0806181717380.20372@blonde.site> (raw)
In-Reply-To: <20080618133857.GB5213@alberich.amd.com>

On Wed, 18 Jun 2008, Andreas Herrmann wrote:
> And the attached patch makes it even shorter.
> (patch against tip/x86/pat -- where your patch is already residing)

Yes, that's delightful, even better, thanks.  After accusing you
of an uninteresting BUG on a fifth value from 2 bits, I had an
inkling that maybe my patch was therefore still stupidly verbose.

> ---
> [PATCH] x86: shrink pat_x_mtrr_type to its essentials
> 
> Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>

Acked-by: Hugh Dickins <hugh@veritas.com>

> ---
>  arch/x86/mm/pat.c |   30 +++++++++++-------------------
>  1 files changed, 11 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
> index ac3a2b1..227df3c 100644
> --- a/arch/x86/mm/pat.c
> +++ b/arch/x86/mm/pat.c
> @@ -161,29 +161,21 @@ static DEFINE_SPINLOCK(memtype_lock); 	/* protects memtype list */
>   */
>  static unsigned long pat_x_mtrr_type(u64 start, u64 end, unsigned long req_type)
>  {
> -	u8 mtrr_type;
> -
> -	/*
> -	 * We return the PAT request directly for types where PAT takes
> -	 * precedence with respect to MTRR and for UC_MINUS.
> -	 * Consistency checks with other PAT requests is done later
> -	 * while going through memtype list.
> -	 */
> -	if (req_type == _PAGE_CACHE_WC ||
> -	    req_type == _PAGE_CACHE_UC_MINUS ||
> -	    req_type == _PAGE_CACHE_UC)
> -		return req_type;
> -
>  	/*
>  	 * Look for MTRR hint to get the effective type in case where PAT
>  	 * request is for WB.
>  	 */
> -	mtrr_type = mtrr_type_lookup(start, end);
> -	if (mtrr_type == MTRR_TYPE_UNCACHABLE)
> -		return _PAGE_CACHE_UC;
> -	if (mtrr_type == MTRR_TYPE_WRCOMB)
> -		return _PAGE_CACHE_WC;
> -	return _PAGE_CACHE_WB;
> +	if (req_type == _PAGE_CACHE_WB) {
> +		u8 mtrr_type;
> +
> +		mtrr_type = mtrr_type_lookup(start, end);
> +		if (mtrr_type == MTRR_TYPE_UNCACHABLE)
> +			return _PAGE_CACHE_UC;
> +		if (mtrr_type == MTRR_TYPE_WRCOMB)
> +			return _PAGE_CACHE_WC;
> +	}
> +
> +	return req_type;
>  }
>  
>  /*

  reply	other threads:[~2008-06-18 16:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-10 14:07 [PATCH 5/5] " Andreas Herrmann
2008-06-16 12:58 ` [PATCH 5/5 v2] " Andreas Herrmann
2008-06-16 17:42   ` Hugh Dickins
2008-06-18  9:51     ` Ingo Molnar
2008-06-18 13:38     ` Andreas Herrmann
2008-06-18 16:28       ` Hugh Dickins [this message]
2008-06-19 10:39       ` Ingo Molnar

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=Pine.LNX.4.64.0806181717380.20372@blonde.site \
    --to=hugh@veritas.com \
    --cc=andreas.herrmann3@amd.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=venkatesh.pallipadi@intel.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

all inboxes | Powered by JetHome®