[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190617185757.b57402b465caff0cf6f85320@linux-foundation.org>
Date: Mon, 17 Jun 2019 18:57:57 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Christophe Leroy <christophe.leroy@....fr>
Cc: David Hildenbrand <david@...hat.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Michal Hocko <mhocko@...e.com>,
Mel Gorman <mgorman@...hsingularity.net>,
Baoquan He <bhe@...hat.com>, linux-mm@...ck.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
linux-kernel@...r.kernel.org, Wei Yang <richard.weiyang@...il.com>,
linux-acpi@...r.kernel.org,
Mike Rapoport <rppt@...ux.vnet.ibm.com>,
Arun KS <arunks@...eaurora.org>,
Johannes Weiner <hannes@...xchg.org>,
Pavel Tatashin <pasha.tatashin@...cle.com>,
Dan Williams <dan.j.williams@...el.com>,
linuxppc-dev@...ts.ozlabs.org, Vlastimil Babka <vbabka@...e.cz>,
Oscar Salvador <osalvador@...e.de>
Subject: Re: [PATCH v1 1/6] mm: Section numbers use the type "unsigned long"
On Sat, 15 Jun 2019 10:06:54 +0200 Christophe Leroy <christophe.leroy@....fr> wrote:
>
>
> Le 14/06/2019 à 21:00, Andrew Morton a écrit :
> > On Fri, 14 Jun 2019 12:01:09 +0200 David Hildenbrand <david@...hat.com> wrote:
> >
> >> We are using a mixture of "int" and "unsigned long". Let's make this
> >> consistent by using "unsigned long" everywhere. We'll do the same with
> >> memory block ids next.
> >>
> >> ...
> >>
> >> - int i, ret, section_count = 0;
> >> + unsigned long i;
> >>
> >> ...
> >>
> >> - unsigned int i;
> >> + unsigned long i;
> >
> > Maybe I did too much fortran back in the day, but I think the
> > expectation is that a variable called "i" has type "int".
> >
> > This?
> >
> >
> >
> > s/unsigned long i/unsigned long section_nr/
>
> From my point of view you degrade readability by doing that.
>
> section_nr_to_pfn(mem->start_section_nr + section_nr);
>
> Three times the word 'section_nr' in one line, is that worth it ? Gives
> me headache.
>
> Codying style says the following, which makes full sense in my opinion:
>
> LOCAL variable names should be short, and to the point. If you have
> some random integer loop counter, it should probably be called ``i``.
> Calling it ``loop_counter`` is non-productive, if there is no chance of it
> being mis-understood.
Well. It did say "integer". Calling an unsigned long `i' is flat out
misleading.
> What about just naming it 'nr' if we want to use something else than 'i' ?
Sure, that works.
Powered by blists - more mailing lists