All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Pavel Emelyanov <xemul@parallels.com>,
	Matt Mackall <mpm@selenic.com>,
	Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Peter Zijlstra <peterz@infradead.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH -mm] mm: Unify pte_to_pgoff and pgoff_to_pte helpers
Date: Wed, 14 Aug 2013 01:08:56 -0700	[thread overview]
Message-ID: <20130814010856.0098398b.akpm@linux-foundation.org> (raw)
In-Reply-To: <20130814074333.GM2869@moon>

On Wed, 14 Aug 2013 11:43:33 +0400 Cyrill Gorcunov <gorcunov@gmail.com> wrote:

> On Wed, Aug 14, 2013 at 12:33:36AM -0700, Andrew Morton wrote:
> > > > B_it_F_ield_OP_eration, Peter I don't mind to use any other
> > > > name, this was just short enough to type.
> > > > 
> > > 
> > > I think it would be useful to have a comment what it means and what
> > > v,r,m,l represent.
> 
> Sure, maybe simply better names as value, rshift, mask, lshift would
> look more understandable. I'll try to use width for mask as well
> (which reminds me BFEXT helpers Andrew mentioned in this thread).
> 
> > Can it be written in C with types and proper variable names and such
> > radical stuff?
> 
> Could you elaborate? You mean inline helper or macro with type checks?

/*
 * description goes here
 */
static inline pteval_t pte_bfop(pteval_t val, int rightshift, ...)
{
	...
}

So much better!  We really should only implement code in a macro if it
*has* to be done as a macro and I don't think that's the case here?

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Pavel Emelyanov <xemul@parallels.com>,
	Matt Mackall <mpm@selenic.com>,
	Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Peter Zijlstra <peterz@infradead.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH -mm] mm: Unify pte_to_pgoff and pgoff_to_pte helpers
Date: Wed, 14 Aug 2013 01:08:56 -0700	[thread overview]
Message-ID: <20130814010856.0098398b.akpm@linux-foundation.org> (raw)
In-Reply-To: <20130814074333.GM2869@moon>

On Wed, 14 Aug 2013 11:43:33 +0400 Cyrill Gorcunov <gorcunov@gmail.com> wrote:

> On Wed, Aug 14, 2013 at 12:33:36AM -0700, Andrew Morton wrote:
> > > > B_it_F_ield_OP_eration, Peter I don't mind to use any other
> > > > name, this was just short enough to type.
> > > > 
> > > 
> > > I think it would be useful to have a comment what it means and what
> > > v,r,m,l represent.
> 
> Sure, maybe simply better names as value, rshift, mask, lshift would
> look more understandable. I'll try to use width for mask as well
> (which reminds me BFEXT helpers Andrew mentioned in this thread).
> 
> > Can it be written in C with types and proper variable names and such
> > radical stuff?
> 
> Could you elaborate? You mean inline helper or macro with type checks?

/*
 * description goes here
 */
static inline pteval_t pte_bfop(pteval_t val, int rightshift, ...)
{
	...
}

So much better!  We really should only implement code in a macro if it
*has* to be done as a macro and I don't think that's the case here?


  reply	other threads:[~2013-08-14  8:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-14  7:00 [PATCH -mm] mm: Unify pte_to_pgoff and pgoff_to_pte helpers Cyrill Gorcunov
2013-08-14  7:00 ` Cyrill Gorcunov
2013-08-14  7:22 ` H. Peter Anvin
2013-08-14  7:22   ` H. Peter Anvin
2013-08-14  7:24   ` Cyrill Gorcunov
2013-08-14  7:24     ` Cyrill Gorcunov
2013-08-14  7:31     ` H. Peter Anvin
2013-08-14  7:31       ` H. Peter Anvin
2013-08-14  7:33       ` Andrew Morton
2013-08-14  7:33         ` Andrew Morton
2013-08-14  7:43         ` Cyrill Gorcunov
2013-08-14  7:43           ` Cyrill Gorcunov
2013-08-14  8:08           ` Andrew Morton [this message]
2013-08-14  8:08             ` Andrew Morton
2013-08-14  8:20             ` Cyrill Gorcunov
2013-08-14  8:20               ` Cyrill Gorcunov
2013-08-14  9:50               ` Ingo Molnar
2013-08-14  9:50                 ` Ingo Molnar
2013-08-14 10:02                 ` Cyrill Gorcunov
2013-08-14 10:02                   ` Cyrill Gorcunov
  -- strict thread matches above, loose matches on Subject: below --
2013-09-14  6:31 Cyrill Gorcunov

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=20130814010856.0098398b.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=gorcunov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@amacapital.net \
    --cc=mingo@elte.hu \
    --cc=mpm@selenic.com \
    --cc=mtosatti@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tglx@linutronix.de \
    --cc=xemul@parallels.com \
    --cc=xiaoguangrong@linux.vnet.ibm.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 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.