All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue@us.ibm.com>
To: Franck <vagabon.xyz@gmail.com>
Cc: Andrew Morton <akpm@osdl.org>, Mel Gorman <mel@skynet.ie>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 6/7] bootmem: use pfn/page conversion macros
Date: Tue, 27 Jun 2006 12:26:37 -0700	[thread overview]
Message-ID: <1151436397.24103.27.camel@localhost.localdomain> (raw)
In-Reply-To: <44A12A85.50303@innova-card.com>

On Tue, 2006-06-27 at 14:54 +0200, Franck Bui-Huu wrote:
>  static void __init free_bootmem_core(bootmem_data_t *bdata, unsigned
> long addr,
>                                      unsigned long size)
>  {
> +       unsigned long sidx, eidx;
>         unsigned long i;
> -       unsigned long start;
> +
>         /*
>          * round down end of usable mem, partially free pages are
>          * considered reserved.
>          */
> -       unsigned long sidx;
> -       unsigned long eidx = (addr + size -
> bdata->node_boot_start)/PAGE_SIZE;
> -       unsigned long end = (addr + size)/PAGE_SIZE;
> -
>         BUG_ON(!size);
> -       BUG_ON(end > bdata->node_low_pfn);
> +       BUG_ON(PFN_DOWN(addr + size) > bdata->node_low_pfn);

In general, I like these kinds of conversions.  But, in this case, I
think it makes the code harder to read.  Those intermediate variables
are really nice and I think they make the code much more readable.  

Do you really prefer:

       BUG_ON(PFN_DOWN(addr + size) > bdata->node_low_pfn)

over

       BUG_ON(end > bdata->node_low_pfn);

Also, these do a bit more than just conversions to using the pfn/page
macros.  With this much churn, it is more than possible that bugs can
creep in.  How about a bit more restrictive conversion to the PFN_
macros, first?

Oh, and if you're going to chew through it later, feel free to make
things like sidx into decent variable names. ;)

Is everybody else OK with this code churn?  It doesn't appear that there
is too much in -mm pending in this area.

-- Dave


  reply	other threads:[~2006-06-27 19:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 13:11 [PATCH] Clean up the bootmem allocator Franck Bui-Huu
2006-06-26 17:58 ` Dave Hansen
2006-06-26 18:10   ` Andrew Morton
2006-06-27  8:23   ` Franck Bui-Huu
2006-06-27 12:53   ` [PATCH 0/7] " Franck Bui-Huu
2006-06-27 12:53   ` [PATCH 1/7] bootmem: remove useless __init in header file Franck Bui-Huu
2006-06-27 17:17     ` Dave Hansen
2006-06-27 19:18       ` Franck Bui-Huu
2006-06-27 12:53   ` [PATCH 2/7] bootmem: mark link_bootmem() as part of the __init section Franck Bui-Huu
2006-06-27 17:17     ` Dave Hansen
2006-06-27 19:18       ` Franck Bui-Huu
2006-06-27 12:54   ` [PATCH 3/7] bootmem: remove useless parentheses in bootmem header file Franck Bui-Huu
2006-06-27 12:54   ` [PATCH 4/7] bootmem: limit to 80 columns width Franck Bui-Huu
2006-06-27 12:54   ` [PATCH 5/7] bootmem: remove useless headers inclusions Franck Bui-Huu
2006-06-27 12:54   ` [PATCH 6/7] bootmem: use pfn/page conversion macros Franck Bui-Huu
2006-06-27 19:26     ` Dave Hansen [this message]
2006-06-29  7:53       ` Franck Bui-Huu
2006-06-27 12:54   ` [PATCH 7/7] bootmem: miscellaneous coding style fixes Franck Bui-Huu
2006-06-27 17:26     ` Dave Hansen
2006-06-27 19:22       ` Franck Bui-Huu
2006-06-27 22:35         ` Randy.Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2006-07-04 15:31 [PATCH 0/7] Clean up the bootmem allocator (try #2) Franck Bui-Huu
2006-07-04 15:45 ` [PATCH 6/7] bootmem: use pfn/page conversion macros Franck Bui-Huu

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=1151436397.24103.27.camel@localhost.localdomain \
    --to=haveblue@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mel@skynet.ie \
    --cc=vagabon.xyz@gmail.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.