linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-mm@kvack.org, thomas.jarosch@intra2net.com,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [patch 1/1] alloc_pages(): permit get_zeroed_page(GFP_ATOMIC) from interrupt context
Date: Mon, 27 Aug 2007 14:32:21 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0708271431030.7123@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0708271411200.6566@schroedinger.engr.sgi.com>

This issue is a result of commit 656dad312fb41ed95ef08325e9df9bece3aacbbb. 
The intend of moving tests before the check for the highpage was to catch 
some additional errors.

On Mon, 27 Aug 2007, Christoph Lameter wrote:

> On Mon, 27 Aug 2007, Andrew Morton wrote:
> 
> > __GFP_HIGHMEM is not set.
> > 
> > : 	/*
> > : 	 * clear_highpage() will use KM_USER0, so it's a bug to use __GFP_ZERO
> > : 	 * and __GFP_HIGHMEM from hard or soft interrupt context.
> > : 	 */
> > : 	VM_BUG_ON((gfp_flags & __GFP_HIGHMEM) && in_interrupt());
> > 
> > __GFP_HIGHMEM is not set
> > 
> > : 	for (i = 0; i < (1 << order); i++)
> > : 		clear_highpage(page + i);
> > 
> > kmap_atomic() goes boom.
> 
> So the page is not a highmem page. kmap does:
> 
> void *kmap(struct page *page)
> {
>         might_sleep();
>         if (!PageHighMem(page))
>                 return page_address(page);
>         return kmap_high(page);
> }
> 
> -> kmap is fine.
> 
> kmap_atomic() does:
> 
> void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot)
> {
>         enum fixed_addresses idx;
>         unsigned long vaddr;
> 
>         /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
>         pagefault_disable();
> 
>         idx = type + KM_TYPE_NR*smp_processor_id();
>         BUG_ON(!pte_none(*(kmap_pte-idx)));
> 
>         if (!PageHighMem(page))
>                 return page_address(page);
> 
>         vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
>         set_pte(kmap_pte-idx, mk_pte(page, prot));
>         arch_flush_lazy_mmu_mode();
> 
>         return (void*) vaddr;
> }
> 
> Move the check for highmem to the beginning of the function? Why 
> should kmap_atomic fail for a non highmem page?
> 
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-08-27 21:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-23 21:07 akpm, Andrew Morton
2007-08-27 20:13 ` Christoph Lameter
2007-08-27 20:33   ` Andrew Morton
2007-08-27 21:00     ` Christoph Lameter
2007-08-27 21:04       ` Andrew Morton
2007-08-27 21:20         ` Christoph Lameter
2007-08-27 21:32           ` Christoph Lameter [this message]
2007-08-27 21:34           ` Andrew Morton
2007-08-27 21:43             ` Christoph Lameter
2007-08-27 22:11               ` Andrew Morton
2007-08-27 22:12                 ` Christoph Lameter
2007-08-27 22:45                   ` Andrew Morton
2007-08-27 23:01                     ` Christoph Lameter
2007-08-27 23:40                       ` Andrew Morton
2007-08-27 23:48                         ` Christoph Lameter

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=Pine.LNX.4.64.0708271431030.7123@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=thomas.jarosch@intra2net.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox