How to allocate hugepage in kernel module?

Murali Annamneni a.murali at hcl.com
Sun Aug 12 02:48:26 EDT 2012


Hi,
You can try by passing the flag GFP_KERNEL to __get_free_pages(). 
Eg: __get_free_pages(GFP_KERNEL,9)  where "9" represents -  Order of 9; means requesting for 2^9(=512) contiguous pages in virtual address space
         in order to allocate 2MB of contiguous memory.


Thanks & Regards
Murali 



-----Original Message-----
From: kernelnewbies-bounces at kernelnewbies.org [mailto:kernelnewbies-bounces at kernelnewbies.org] On Behalf Of kernelnewbies-request at kernelnewbies.org
Sent: Friday, August 10, 2012 9:30 PM
To: kernelnewbies at kernelnewbies.org
Subject: Kernelnewbies Digest, Vol 21, Issue 13

Send Kernelnewbies mailing list submissions to
	kernelnewbies at kernelnewbies.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
or, via email, send a message with subject or body 'help' to
	kernelnewbies-request at kernelnewbies.org

You can reach the person managing the list at
	kernelnewbies-owner at kernelnewbies.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of Kernelnewbies digest..."


Today's Topics:

   1. Re: How to allocate hugepage in kernel module? (J.Hwan Kim)
   2. Re: How to allocate hugepage in kernel module? (anish kumar)


----------------------------------------------------------------------

Message: 1
Date: Fri, 10 Aug 2012 09:00:12 +0900
From: "J.Hwan Kim" <frog1120 at gmail.com>
Subject: Re: How to allocate hugepage in kernel module?
To: Denis Kirjanov <kirjanov at gmail.com>
Cc: kernelnewbies at kernelnewbies.org
Message-ID: <50244F0C.90109 at gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed

I set the __GFP_COMP flag to __get_free_pages(), but the result was same.

2012? 08? 09? 17:59, Denis Kirjanov ? ?:
> Forgot to CC kernelnewbies:
>
> Did you pass the __GFP_COMP flag to __get_free_pages?
>
>
> On 8/9/12, J.Hwan Kim<frog1120 at gmail.com>  wrote:
>> Hi, everyone
>>
>> How can I allocate physically contiguous huge page in kernel module ?
>> The routine of _get_fee_pages() fails whenever there are much free 
>> memory in system.
>>
>> I found the procedures for set hugepages with sysctl or 
>> /proc/sys/vm/nr_hugepages but I've not found the api for allocate the 
>> huge page in kernel.
>>
>> Thanks in advnace.
>>
>> Best Regards,
>> J.Hwan Kim
>>
>>
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>




------------------------------

Message: 2
Date: Thu, 09 Aug 2012 20:18:02 -0700
From: anish kumar <anish198519851985 at gmail.com>
Subject: Re: How to allocate hugepage in kernel module?
To: "J.Hwan Kim" <frog1120 at gmail.com>
Cc: Denis Kirjanov <kirjanov at gmail.com>,
	kernelnewbies at kernelnewbies.org
Message-ID: <1344568682.1532.30.camel at anish-Inspiron-N5050>
Content-Type: text/plain; charset="UTF-8"

On Fri, 2012-08-10 at 09:00 +0900, J.Hwan Kim wrote:
> I set the __GFP_COMP flag to __get_free_pages(), but the result was 
> same.

Does this help?
sourd/core/memalloc.c +170

> 2012? 08? 09? 17:59, Denis Kirjanov ? ?:
> > Forgot to CC kernelnewbies:
> >
> > Did you pass the __GFP_COMP flag to __get_free_pages?
> >
> >
> > On 8/9/12, J.Hwan Kim<frog1120 at gmail.com>  wrote:
> >> Hi, everyone
> >>
> >> How can I allocate physically contiguous huge page in kernel module ?
> >> The routine of _get_fee_pages() fails whenever there are much free 
> >> memory in system.
> >>
> >> I found the procedures for set hugepages with sysctl or 
> >> /proc/sys/vm/nr_hugepages but I've not found the api for allocate 
> >> the huge page in kernel.
> >>
> >> Thanks in advnace.
> >>
> >> Best Regards,
> >> J.Hwan Kim
> >>
> >>
> >>
> >> _______________________________________________
> >> Kernelnewbies mailing list
> >> Kernelnewbies at kernelnewbies.org
> >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >>
> >
> 
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies





------------------------------

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


End of Kernelnewbies Digest, Vol 21, Issue 13
*********************************************


::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and other defects.

----------------------------------------------------------------------------------------------------------------------------------------------------




More information about the Kernelnewbies mailing list