public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RE: [patch] fix ia64 hugetlb_free_pgd_range
@ 2006-02-24  6:30 Chen, Kenneth W
  2006-02-27  0:27 ` David Gibson
  0 siblings, 1 reply; 6+ messages in thread
From: Chen, Kenneth W @ 2006-02-24  6:30 UTC (permalink / raw)
  To: David Gibson; +Cc: Hugh Dickins, Luck, Tony, linux-ia64, linux-kernel

David Gibson wrote on Thursday, February 23, 2006 8:06 PM
> But I don't see how not transforming them sometimes can be correct.
> Suppose 'floor' is only a little way below 'addr' - addr will be
> shifted down, but floor won't, so floor may now be above addr, which
> will cause weird results.
> 
> Afaict the *only* thing floor and ceiling are used for is bounds
> checking the address range we're examining.  How can that ever be
> right if one address has been scaled down, but the other hasn't.

The scale down isn't exactly on every address bits.  Top 3 bits of
virtual address are preserved.

#define htlbpage_to_page(x)    (((unsigned long) REGION_NUMBER(x) << 61)
                                 | (REGION_OFFSET(x) >>
(HPAGE_SHIFT-PAGE_SHIFT)))

So scaled address for a hugetlb address will never be below unscaled
normal page address.  That is adjusted addr will never below unchanged
floor.

- Ken

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [patch] fix ia64 hugetlb_free_pgd_range
@ 2006-02-24  1:45 Chen, Kenneth W
  2006-02-24  2:44 ` 'David Gibson'
  0 siblings, 1 reply; 6+ messages in thread
From: Chen, Kenneth W @ 2006-02-24  1:45 UTC (permalink / raw)
  To: 'David Gibson', 'Hugh Dickins', Luck, Tony
  Cc: linux-ia64, linux-kernel

I've looked at hugetlb_free_pgd_range() right side up, right side
down, up side up, up side down.  And it just doesn't look correct
to me at all.

In that function, we do address transformation before calling
free_pgd_range, so the generic function can traverse to right set
of page table page.  There is no need to do any range check.

Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>

--- ./arch/ia64/mm/hugetlbpage.c.orig	2006-02-23 18:21:28.202422392 -0800
+++ ./arch/ia64/mm/hugetlbpage.c	2006-02-23 18:26:28.256129654 -0800
@@ -125,9 +125,9 @@ void hugetlb_free_pgd_range(struct mmu_g
 
 	addr = htlbpage_to_page(addr);
 	end  = htlbpage_to_page(end);
-	if (is_hugepage_only_range(tlb->mm, floor, HPAGE_SIZE))
+	if (REGION_NUMBER(floor) == RGN_HPAGE)
 		floor = htlbpage_to_page(floor);
-	if (is_hugepage_only_range(tlb->mm, ceiling, HPAGE_SIZE))
+	if (REGION_NUMBER(ceiling) == RGN_HPAGE)
 		ceiling = htlbpage_to_page(ceiling);
 
 	free_pgd_range(tlb, addr, end, floor, ceiling);



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-02-27  0:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-24  6:30 [patch] fix ia64 hugetlb_free_pgd_range Chen, Kenneth W
2006-02-27  0:27 ` David Gibson
  -- strict thread matches above, loose matches on Subject: below --
2006-02-24  1:45 Chen, Kenneth W
2006-02-24  2:44 ` 'David Gibson'
2006-02-24  3:05   ` Chen, Kenneth W
2006-02-24  4:05     ` 'David Gibson'

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox