All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Tomasz Stanislawski <t.stanislaws@samsung.com>
Cc: paul.gortmaker@windriver.com, '박경민' <kyungmin.park@samsung.com>,
	amwang@redhat.com, dri-devel@lists.freedesktop.org,
	"'???/Mobile S/W Platform Lab.(???)/E3(??)/????'"
	<inki.dae@samsung.com>,
	prashanth.g@samsung.com,
	"Marek Szyprowski" <m.szyprowski@samsung.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Rob Clark" <rob@ti.com>, "Dave Airlie" <airlied@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	"Andy Whitcroft" <apw@shadowen.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>
Subject: Re: [PATCH v3] scatterlist: add sg_alloc_table_from_pages function
Date: Tue, 22 May 2012 13:10:59 -0700	[thread overview]
Message-ID: <20120522131059.415a881c.akpm@linux-foundation.org> (raw)
In-Reply-To: <4FBA4ACE.4080602@samsung.com>

On Mon, 21 May 2012 16:01:50 +0200
Tomasz Stanislawski <t.stanislaws@samsung.com> wrote:

> >> +int sg_alloc_table_from_pages(struct sg_table *sgt,
> >> +	struct page **pages, unsigned int n_pages,
> >> +	unsigned long offset, unsigned long size,
> >> +	gfp_t gfp_mask)
> > 
> > I guess a 32-bit n_pages is OK.  A 16TB IO seems enough ;)
> > 
> 
> Do you think that 'unsigned long' for offset is too big?
> 
> Ad n_pages. Assuming that Moore's law holds it will take
> circa 25 years before the limit of 16 TB is reached :) for
> high-end scatterlist operations.
> Or I can change the type of n_pages to 'unsigned long' now at
> no cost :).

By then it will be Someone Else's Problem ;)

> >> +{
> >> +	unsigned int chunks;
> >> +	unsigned int i;
> > 
> > erk, please choose a different name for this.  When a C programmer sees
> > "i", he very much assumes it has type "int".  Making it unsigned causes
> > surprise.
> > 
> > And don't rename it to "u"!  Let's give it a nice meaningful name.  pageno?
> > 
> 
> The problem is that 'i' is  a natural name for a loop counter.

It's also the natural name for an integer.  If a C programmer sees "i",
he thinks "int".  It's a Fortran thing ;)

> AFAIK, in the kernel code developers try to avoid Hungarian notation.
> A name of a variable should reflect its purpose, not its type.
> I can change the name of 'i' to 'pageno' and 'j' to 'pageno2' (?)
> but I think it will make the code less reliable.

Well, one could do something radical such as using "p".


--
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 internet charges in Canada: sign http://stopthemeter.ca/
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: Tomasz Stanislawski <t.stanislaws@samsung.com>
Cc: paul.gortmaker@windriver.com, '박경민' <kyungmin.park@samsung.com>,
	amwang@redhat.com, dri-devel@lists.freedesktop.org,
	"'???/Mobile S/W Platform Lab.(???)/E3(??)/????'"
	<inki.dae@samsung.com>,
	prashanth.g@samsung.com,
	"Marek Szyprowski" <m.szyprowski@samsung.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Rob Clark" <rob@ti.com>, "Dave Airlie" <airlied@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	"Andy Whitcroft" <apw@shadowen.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>
Subject: Re: [PATCH v3] scatterlist: add sg_alloc_table_from_pages function
Date: Tue, 22 May 2012 13:10:59 -0700	[thread overview]
Message-ID: <20120522131059.415a881c.akpm@linux-foundation.org> (raw)
In-Reply-To: <4FBA4ACE.4080602@samsung.com>

On Mon, 21 May 2012 16:01:50 +0200
Tomasz Stanislawski <t.stanislaws@samsung.com> wrote:

> >> +int sg_alloc_table_from_pages(struct sg_table *sgt,
> >> +	struct page **pages, unsigned int n_pages,
> >> +	unsigned long offset, unsigned long size,
> >> +	gfp_t gfp_mask)
> > 
> > I guess a 32-bit n_pages is OK.  A 16TB IO seems enough ;)
> > 
> 
> Do you think that 'unsigned long' for offset is too big?
> 
> Ad n_pages. Assuming that Moore's law holds it will take
> circa 25 years before the limit of 16 TB is reached :) for
> high-end scatterlist operations.
> Or I can change the type of n_pages to 'unsigned long' now at
> no cost :).

By then it will be Someone Else's Problem ;)

> >> +{
> >> +	unsigned int chunks;
> >> +	unsigned int i;
> > 
> > erk, please choose a different name for this.  When a C programmer sees
> > "i", he very much assumes it has type "int".  Making it unsigned causes
> > surprise.
> > 
> > And don't rename it to "u"!  Let's give it a nice meaningful name.  pageno?
> > 
> 
> The problem is that 'i' is  a natural name for a loop counter.

It's also the natural name for an integer.  If a C programmer sees "i",
he thinks "int".  It's a Fortran thing ;)

> AFAIK, in the kernel code developers try to avoid Hungarian notation.
> A name of a variable should reflect its purpose, not its type.
> I can change the name of 'i' to 'pageno' and 'j' to 'pageno2' (?)
> but I think it will make the code less reliable.

Well, one could do something radical such as using "p".



  reply	other threads:[~2012-05-22 20:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-08  9:50 [PATCH v3] scatterlist: add sg_alloc_table_from_pages function Tomasz Stanislawski
2012-05-08  9:50 ` Tomasz Stanislawski
2012-05-08  9:50 ` Tomasz Stanislawski
2012-05-08 10:02 ` Daniel Vetter
2012-05-08 11:14 ` Laurent Pinchart
2012-05-08 11:14   ` Laurent Pinchart
2012-05-17 23:56 ` Andrew Morton
2012-05-21 14:01   ` Tomasz Stanislawski
2012-05-21 14:01     ` Tomasz Stanislawski
2012-05-22 20:10     ` Andrew Morton [this message]
2012-05-22 20:10       ` Andrew Morton
2012-06-06 12:14       ` Tomasz Stanislawski
2012-06-06 12:14         ` Tomasz Stanislawski

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=20120522131059.415a881c.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=airlied@redhat.com \
    --cc=amwang@redhat.com \
    --cc=apw@shadowen.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hannes@cmpxchg.org \
    --cc=inki.dae@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=m.szyprowski@samsung.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=prashanth.g@samsung.com \
    --cc=rob@ti.com \
    --cc=t.stanislaws@samsung.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.