Re: [patch] hugetlb: remove dummy definitions of HPAGE_MASK andHPAGE_SIZE

From: Andrew Morton
Date: Thu Nov 17 2011 - 18:57:05 EST


On Thu, 17 Nov 2011 15:52:28 -0800
David Daney <ddaney.cavm@xxxxxxxxx> wrote:

> A counter argument would be:
>
> There are hundreds of places in the kernel where dummy definitions are
> selected by !CONFIG_* so that we can do:
>
> if (test_something()) {
> do_one_thing();
> } else {
> do_the_other_thing();
> }
>
>
> Rather than:
>
> #ifdef CONFIG_SOMETHING
> if (test_something()) {
> do_one_thing();
> } else
> #else
> {
> do_the_other_thing();
> }
>
>
>
> We even do this all over the place with dummy definitions selected by
> CONFIG_HUGETLB_PAGE, What exactly makes HPAGE_MASK special and not the
> hundreds of other similar situations?

yup. Look at free_pgtables():

if (is_vm_hugetlb_page(vma)) {
hugetlb_free_pgd_range(tlb, addr, vma->vm_end,
floor, next? next->vm_start: ceiling);
} else {

and

#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })

This is the same thing.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/