linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* why inode creation with GFP_HIGHUSER?
       [not found] <34a75100609130734m68729bdaj30258c10edfa7947@mail.gmail.com>
@ 2006-09-13 14:54 ` girish
  2006-09-13 17:32   ` Christoph Lameter
  0 siblings, 1 reply; 4+ messages in thread
From: girish @ 2006-09-13 14:54 UTC (permalink / raw)
  To: Linux-MM

[hello world. my first mail  linux-mm]

i am following a trail of high-memory initialization on a MIPS32 based
system. i came across inode initialization.

i'd like to know why page(s) for inodes are allocated with
GFP_HIGHUSER & not with GFP_USER mask? is there any particular need
that the address_space be set with GFP_HIGHUSER flag?

(ref: http://lxr.free-electrons.com/source/fs/inode.c#150)
(ref: http://lxr.free-electrons.com/source/include/linux/pagemap.h#031)

i intend to allocate highmem pages strictly to user processes. my idea
is to completely avoid kernel mapping for these pages. so, as a dirty
hack - i changed mapping_set_gfp_mask function not to honor
__GFP_HIGHMEM zone selector if __GFP_IO | __GFP_FS are set. in short i
replace  GFP_HIGHUSER with GFP_USER mask. with this change the kernel
comes to life. but i am still confused about the effect of this change
on system, that i am yet to see?

any help in this regards will be greatly appreciated.

thanks in advance.
girish.

--
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>

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

* Re: why inode creation with GFP_HIGHUSER?
  2006-09-13 14:54 ` why inode creation with GFP_HIGHUSER? girish
@ 2006-09-13 17:32   ` Christoph Lameter
  2006-09-13 22:27     ` girish
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Lameter @ 2006-09-13 17:32 UTC (permalink / raw)
  To: girish; +Cc: Linux-MM

On Wed, 13 Sep 2006, girish wrote:

> i'd like to know why page(s) for inodes are allocated with
> GFP_HIGHUSER & not with GFP_USER mask? is there any particular need
> that the address_space be set with GFP_HIGHUSER flag?

GFP_HIGHUSER allows the use of HIGH memory but it does not require it. If 
the system has no HIGHMEM then we will just use regular memory.

> i intend to allocate highmem pages strictly to user processes. my idea
> is to completely avoid kernel mapping for these pages. so, as a dirty
> hack - i changed mapping_set_gfp_mask function not to honor
> __GFP_HIGHMEM zone selector if __GFP_IO | __GFP_FS are set. in short i
> replace  GFP_HIGHUSER with GFP_USER mask. with this change the kernel
> comes to life. but i am still confused about the effect of this change
> on system, that i am yet to see?

I am not sure what you intend to do. The kernel already avoids mapping 
highmem pages into the kernel as much as possible.

--
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>

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

* Re: why inode creation with GFP_HIGHUSER?
  2006-09-13 17:32   ` Christoph Lameter
@ 2006-09-13 22:27     ` girish
  2006-09-13 22:30       ` Christoph Lameter
  0 siblings, 1 reply; 4+ messages in thread
From: girish @ 2006-09-13 22:27 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: Linux-MM

> > i'd like to know why page(s) for inodes are allocated with
> > GFP_HIGHUSER & not with GFP_USER mask? is there any particular need
> > that the address_space be set with GFP_HIGHUSER flag?
>
> GFP_HIGHUSER allows the use of HIGH memory but it does not require it. If
> the system has no HIGHMEM then we will just use regular memory.

i understand the policy of zone fallback. but in my case there is, in
fact bigger chunk, meory marked as high memory. please see below for
further explaination -

> > i intend to allocate highmem pages strictly to user processes. my idea
> > is to completely avoid kernel mapping for these pages. so, as a dirty
> > hack - i changed mapping_set_gfp_mask function not to honor
> > __GFP_HIGHMEM zone selector if __GFP_IO | __GFP_FS are set. in short i
> > replace  GFP_HIGHUSER with GFP_USER mask. with this change the kernel
> > comes to life. but i am still confused about the effect of this change
> > on system, that i am yet to see?
>
> I am not sure what you intend to do. The kernel already avoids mapping
> highmem pages into the kernel as much as possible.

that's the whole confusion. kernel is supposed to *avoid* allocating
from ZONE_HIGHMEM if there is some memory left in ZONE_DMA and/or
ZONE_NORMAL. but as i mentioned the zonelist selection that happens
based  on GFP_* mask (in this case GFP_HIGHUSER), makes __alloc_pages
to allocate from a list which has both HIGHMEM and DMA/NORMAL zones
listed in it. the zonelist looping/fallback is as implemented in
get_page_from_freelist (). to this function, the zonelist that is
passed contains both and in the order - HIGHMEM and DMA/NORMAL zones.
shouldn't it be NORMAl/DMA first and then HIGHMEM in the zonelist?

(ref: http://lxr.free-electrons.com/source/mm/page_alloc.c#883)

thanks.

--
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>

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

* Re: why inode creation with GFP_HIGHUSER?
  2006-09-13 22:27     ` girish
@ 2006-09-13 22:30       ` Christoph Lameter
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2006-09-13 22:30 UTC (permalink / raw)
  To: girish; +Cc: Linux-MM

On Thu, 14 Sep 2006, girish wrote:

> > I am not sure what you intend to do. The kernel already avoids mapping
> > highmem pages into the kernel as much as possible.
> 
> that's the whole confusion. kernel is supposed to *avoid* allocating
> from ZONE_HIGHMEM if there is some memory left in ZONE_DMA and/or

The kernel favors ZONE_HIGHMEM allocations for certain type of 
allocations. Like those marked GF_HIGHUSER. It avoid establishing
mappings of its own. The mappings via the page tables are easier on
the machine and so the application will be fine with HIGHMEM pages.

> ZONE_NORMAL. but as i mentioned the zonelist selection that happens
> based  on GFP_* mask (in this case GFP_HIGHUSER), makes __alloc_pages
> to allocate from a list which has both HIGHMEM and DMA/NORMAL zones
> listed in it. the zonelist looping/fallback is as implemented in
> get_page_from_freelist (). to this function, the zonelist that is
> passed contains both and in the order - HIGHMEM and DMA/NORMAL zones.
> shouldn't it be NORMAl/DMA first and then HIGHMEM in the zonelist?

The fallback sequence is HIGHMEM / NORMAL / DMA for a GFP_HIGHUSER 
allocation.


--
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>

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

end of thread, other threads:[~2006-09-13 22:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <34a75100609130734m68729bdaj30258c10edfa7947@mail.gmail.com>
2006-09-13 14:54 ` why inode creation with GFP_HIGHUSER? girish
2006-09-13 17:32   ` Christoph Lameter
2006-09-13 22:27     ` girish
2006-09-13 22:30       ` Christoph Lameter

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