lkml.org 
[lkml]   [2013]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/3] mm: rename confusing function names
On Tue, 5 Feb 2013 14:26:40 -0500
Johannes Weiner <hannes@cmpxchg.org> wrote:

> On Wed, Feb 06, 2013 at 01:09:55AM +0800, Zhang Yanfei wrote:
> > Function nr_free_zone_pages, nr_free_buffer_pages and nr_free_pagecache_pages
> > are horribly badly named, they count present_pages - pages_high within zones
> > instead of free pages, so why not rename them to reasonable names, not cofusing
> > people.
> >
> > patch2 and patch3 are based on patch1. So please apply patch1 first.
> >
> > Zhang Yanfei (3):
> > mm: rename nr_free_zone_pages to nr_free_zone_high_pages
> > mm: rename nr_free_buffer_pages to nr_free_buffer_high_pages
> > mm: rename nr_free_pagecache_pages to nr_free_pagecache_high_pages
>
> I don't feel that this is an improvement.
>
> As you said, the "free" is already misleading, because those pages
> might all be allocated. "High" makes me think not just of highmem,
> but drug abuse in general.
>
> nr_available_*_pages? I don't know, but if we go through with all
> that churn, it had better improve something.

Yes, those names are ghastly.

Here's an idea: accurately document the functions with code comments.
Once this is done, that documentation may well suggest a good name ;)


While we're there, please note that nr_free_buffer_pages() has a *lot*
of callers. Generally it's code which is trying to work out what is an
appropriate size for preallocated caching space, lookup tables, etc.

That's a rather hopeless objective, given memory hotplug, mlock, etc.
But please do take a look at *why* these callers are calling
nr_free_buffer_pages() and let's ensure that both the implementation
and name are appropriate to their requirements.





\
 
 \ /
  Last update: 2013-02-06 00:22    [W:0.054 / U:12.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site