All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [BK-2.4] [Patch] Small do_mmap_pgoff correction
@ 2002-12-10 20:50 DervishD
  2002-12-10 21:02 ` vmalloc Imran Badr
  0 siblings, 1 reply; 6+ messages in thread
From: DervishD @ 2002-12-10 20:50 UTC (permalink / raw)
  To: Linux-kernel

    Hi David :)

>    + *	NOTE: in this function we rely on TASK_SIZE being lower than
>    + *	SIZE_MAX-PAGE_SIZE at least. I'm pretty sure that it is.
> This assumption is wrong.

    OK, then another way of fixing the corner case that exists in
do_mmap_pgoff is needed. You cannot mmap a chunk of memory whose size
is bigger than SIZE_MAX-PAGE_SIZE, because 'PAGE_ALIGN' will return 0
when page-aligning the size.

    Anyway you cannot use a size larger than SIZE_MAX-PAGE_SIZE even
on sparc64, since mmap will fail when page aligning such a size,
returning 0 :((( Reverting the change is worse (IMHO).

> Please revert this change, it adds absolutely nothing.

    It corrects the corner case. See below. If you have a better
solution for the corner case problem that doesn't involve limiting
the max size you can request for mmaping so it doesn't get the last
page, it is welcome, of course :))

    The code says:

    if ((len = PAGE_ALIGN(len)) == 0)

    and this returns 0 if the requested size ('len', here) is between
SIZE_MAX-PAGE_SIZE and SIZE_MAX. And this is wrong. Don't know if
under sparc64 the PAGE_ALIGN macro returns correct values, but I
don't think so, since the correct value for an address in the last
page is 0 when page aligned. The problem is that we are aligning a
SIZE, not an address :((

    Maybe a new macro needed here...

    If you want the entire explanation, just tell :) I wrote in the
past for the same patch. Anyway, nor Linus nor Alan did see anything
wrong with this :??

    Raúl

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

* vmalloc
  2002-12-10 20:50 [BK-2.4] [Patch] Small do_mmap_pgoff correction DervishD
@ 2002-12-10 21:02 ` Imran Badr
  2002-12-10 21:12   ` vmalloc Arjan van de Ven
  0 siblings, 1 reply; 6+ messages in thread
From: Imran Badr @ 2002-12-10 21:02 UTC (permalink / raw)
  To: Linux-kernel


Hi,
Is there any limitation on the amount of memory that can be allocated by
using vmalloc ( like 128KB for kmalloc) ?

Thanks,
Imran.





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

* Re: vmalloc
  2002-12-10 21:02 ` vmalloc Imran Badr
@ 2002-12-10 21:12   ` Arjan van de Ven
  2002-12-11  6:16     ` vmalloc Joseph D. Wagner
  0 siblings, 1 reply; 6+ messages in thread
From: Arjan van de Ven @ 2002-12-10 21:12 UTC (permalink / raw)
  To: imran.badr; +Cc: Linux-kernel

On Tue, 2002-12-10 at 22:02, Imran Badr wrote:
> 
> Hi,
> Is there any limitation on the amount of memory that can be allocated by
> using vmalloc ( like 128KB for kmalloc) ?
> 
for x86 you shouldn't count on being to get more than 64Mb of vmalloc
memory (even though most machines go upto 128Mb at least)

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

* RE: vmalloc
  2002-12-10 21:12   ` vmalloc Arjan van de Ven
@ 2002-12-11  6:16     ` Joseph D. Wagner
  0 siblings, 0 replies; 6+ messages in thread
From: Joseph D. Wagner @ 2002-12-11  6:16 UTC (permalink / raw)
  To: 'Arjan van de Ven', imran.badr; +Cc: 'Linux-kernel'

>> Is there any limitation on the amount of
>> memory that can be allocated by using vmalloc
>> ( like 128KB for kmalloc) ?

> for x86 you shouldn't count on being to get more
> than 64Mb of vmalloc memory (even though most
> machines go upto 128Mb at least)

According to the specifications, vmalloc is limited only by the amount of
physical memory on your machine.  However, Arjan VanDeVen has a point.
Other process are already using physical memory (like the kernel process),
and those process count against the physical memory available.

TIP: It's always nice to leave at least 20% of the physical memory free for
other critical processes, especially those that can't be swapped out.

Joseph Wagner


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

* Vmalloc
       [not found] <CAMGjyMubkhwFwHyfYHeJH4fUXOpexCtZ1RLgWDTRSw2Vf-86wg@mail.gmail.com>
@ 2016-09-06 14:42 ` Er Krishna
  2016-09-06 18:36   ` Vmalloc Prabhunath G
  0 siblings, 1 reply; 6+ messages in thread
From: Er Krishna @ 2016-09-06 14:42 UTC (permalink / raw)
  To: kernelnewbies

> Hi all
>
> I have one confusion, so asking this question for understanding:
>
> Vmalloc return address are virtually contiguous or not ?
>
> Basically vmalloc return non contiguous memory from ram which may not be
one to one mapped in process kernel address space .
>
> Is my above understanding correct?
>
> Thanks
> Krishna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160906/ab854fac/attachment.html 

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

* Vmalloc
  2016-09-06 14:42 ` Vmalloc Er Krishna
@ 2016-09-06 18:36   ` Prabhunath G
  0 siblings, 0 replies; 6+ messages in thread
From: Prabhunath G @ 2016-09-06 18:36 UTC (permalink / raw)
  To: kernelnewbies

vmalloc() may allocate non-contiguous physical memory and map it to
contiguous kernel virtual address.

For eg. if you ask for 10 page frames of physical memory i.e. 10 * 4K,
vmalloc() will scout for 10 page frames of physical memory, they need not
be contiguous,
and map them to contiguous kernel virtual address (last 128 MB of virtual
address in a 3G/1G partition, assuming >= 1GB of RAM)

 This could be of some help and is also somewhat extension of your question
https://lists.kernelnewbies.org/pipermail/kernelnewbies/2011-June/002335.html


On Tue, Sep 6, 2016 at 8:12 PM, Er Krishna <erkrishna@gmail.com> wrote:

> > Hi all
> >
> > I have one confusion, so asking this question for understanding:
> >
> > Vmalloc return address are virtually contiguous or not ?
> >
> > Basically vmalloc return non contiguous memory from ram which may not be
> one to one mapped in process kernel address space .
> >
> > Is my above understanding correct?
> >
> > Thanks
> > Krishna
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>


-- 
Regards,
Prabhunath G
Linux Trainer
Bangalore
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160907/52148ea0/attachment.html 

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

end of thread, other threads:[~2016-09-06 18:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-10 20:50 [BK-2.4] [Patch] Small do_mmap_pgoff correction DervishD
2002-12-10 21:02 ` vmalloc Imran Badr
2002-12-10 21:12   ` vmalloc Arjan van de Ven
2002-12-11  6:16     ` vmalloc Joseph D. Wagner
     [not found] <CAMGjyMubkhwFwHyfYHeJH4fUXOpexCtZ1RLgWDTRSw2Vf-86wg@mail.gmail.com>
2016-09-06 14:42 ` Vmalloc Er Krishna
2016-09-06 18:36   ` Vmalloc Prabhunath G

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.