* How to allocate hugepage in kernel module?
@ 2012-08-09 7:14 J.Hwan Kim
2012-08-09 8:59 ` Denis Kirjanov
0 siblings, 1 reply; 6+ messages in thread
From: J.Hwan Kim @ 2012-08-09 7:14 UTC (permalink / raw)
To: kernelnewbies
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to allocate hugepage in kernel module?
2012-08-09 7:14 How to allocate hugepage in kernel module? J.Hwan Kim
@ 2012-08-09 8:59 ` Denis Kirjanov
2012-08-10 0:00 ` J.Hwan Kim
0 siblings, 1 reply; 6+ messages in thread
From: Denis Kirjanov @ 2012-08-09 8:59 UTC (permalink / raw)
To: kernelnewbies
Forgot to CC kernelnewbies:
Did you pass the __GFP_COMP flag to __get_free_pages?
On 8/9/12, J.Hwan Kim <frog1120@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
>
--
Regards,
Denis
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to allocate hugepage in kernel module?
2012-08-09 8:59 ` Denis Kirjanov
@ 2012-08-10 0:00 ` J.Hwan Kim
2012-08-10 3:18 ` anish kumar
0 siblings, 1 reply; 6+ messages in thread
From: J.Hwan Kim @ 2012-08-10 0:00 UTC (permalink / raw)
To: kernelnewbies
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@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
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to allocate hugepage in kernel module?
2012-08-10 0:00 ` J.Hwan Kim
@ 2012-08-10 3:18 ` anish kumar
0 siblings, 0 replies; 6+ messages in thread
From: anish kumar @ 2012-08-10 3:18 UTC (permalink / raw)
To: kernelnewbies
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@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
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to allocate hugepage in kernel module?
@ 2012-08-12 6:48 Murali Annamneni
0 siblings, 0 replies; 6+ messages in thread
From: Murali Annamneni @ 2012-08-12 6:48 UTC (permalink / raw)
To: kernelnewbies
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@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@gmail.com>
Subject: Re: How to allocate hugepage in kernel module?
To: Denis Kirjanov <kirjanov@gmail.com>
Cc: kernelnewbies at kernelnewbies.org
Message-ID: <50244F0C.90109@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@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@gmail.com>
Subject: Re: How to allocate hugepage in kernel module?
To: "J.Hwan Kim" <frog1120@gmail.com>
Cc: Denis Kirjanov <kirjanov@gmail.com>,
kernelnewbies at kernelnewbies.org
Message-ID: <1344568682.1532.30.camel@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@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.
----------------------------------------------------------------------------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread* How to allocate hugepage in kernel module?
@ 2012-08-12 7:47 aurum spark
0 siblings, 0 replies; 6+ messages in thread
From: aurum spark @ 2012-08-12 7:47 UTC (permalink / raw)
To: kernelnewbies
Hi J.Hwan Kim,
Before we talk about APIs let's understand few things about requirement
1. How much contiguous memory do you require for you module ?
2. Should it be DMAble ?
3. Are you going to use that as shared memory with any other card or processor ?
So there are certain API which can provide you huge chunk of contiguous memory.
1. One of them as you are using is get_free_pages(). Try suggestions
by others to get rid of error.
2. Another thing you can use is dma_alloc_coherent(). But there is
limit on this and you should consider that other modules will also
required DMAble memory.
3. Depending on the kernel version you are using you can do
bootmem_reserve() API during initialization code of kernel and you can
keep this memory reserved for your module. Pass that as platform data.
4. You can try passing say mem=768M parameter through kernel
commandline(assuming you have 1G of memory). That will force kernel to
use 768M and you can use rest of the 256M memory by doing ioremap in
your module.
Regards,
~/Aurum
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-08-12 7:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-09 7:14 How to allocate hugepage in kernel module? J.Hwan Kim
2012-08-09 8:59 ` Denis Kirjanov
2012-08-10 0:00 ` J.Hwan Kim
2012-08-10 3:18 ` anish kumar
-- strict thread matches above, loose matches on Subject: below --
2012-08-12 6:48 Murali Annamneni
2012-08-12 7:47 aurum spark
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.