Re: [PATCH]: Handling spurious page fault for hugetlb region for 2.6.14-rc4-git5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 18 Oct 2005, Andrew Morton wrote:
> Rohit Seth <[email protected]> wrote:
> >
> > The prefetching problem is handled OK for regular pages because we can
> >  handle page faults corresponding to those pages.  That is currently not
> >  true for hugepages.  Currently the kernel assumes that PAGE_FAULT
> >  happening against a hugetlb page is caused by truncate and returns
> >  SIGBUS.

Is Rohit's intended to be a late 2.6.14 fix?  We seem to have done well
without it for several years, and are just on the point of changing to
prefaulting the hugetlb pages anyway, which will fix it up.

> @@ -2045,8 +2045,18 @@ int __handle_mm_fault(struct mm_struct *
>  
>  	inc_page_state(pgfault);
>  
> -	if (is_vm_hugetlb_page(vma))
> -		return VM_FAULT_SIGBUS;	/* mapping truncation does this. */
> +	if (unlikely(is_vm_hugetlb_page(vma))) {
> +		if (valid_hugetlb_file_off(vma, address))
> +			/* We get here only if there was a stale(zero) TLB entry
> +			 * (because of  HW prefetching).
> +			 * Low-level arch code (if needed) should have already
> +			 * purged the stale entry as part of this fault handling.
> +			 * Here we just return.
> +			 */
> +			return VM_FAULT_MINOR;
> +		else
> +			return VM_FAULT_SIGBUS;	/* mapping truncation does this. */
> +	}

(I'm not surprised that the low-level arch code fixes this up as part of the
fault handling.  I am surprised that it does so only after giving the fault
to the kernel.  Sounds like something's gone wrong.)

What happens when the hugetlb file is truncated down and back up after
the mmap?  Truncating down will remove a page from the mmap and flush TLB.
Truncating up will let accesses to the gone page pass the valid...off test.
But we've no support for hugetlb faulting in this version: so won't it get
get stuck in a tight loop?

If it's decided that this issue is actually an ia64 one, and does need to
be fixed right now, then I'd have thought your idea of fixing it at the
ia64 end better: arch/ia64/mm/fault.c already has code for discarding
faults on speculative loads, and ia64 has an RGN_HPAGE set aside for
hugetlb, so shouldn't it just discard speculative loads on that region?

Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux