Re: User-supplied stacks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/20/06, Elad Lahav <elahav@xxxxxxxxxxxx> wrote:
> how is it different from kernel memory at that point? ;)
It resides in user space, and for my research it makes a difference.

 From a purely OS theoretical point of view, I find it a good idea for
the application to provide resources to the kernel when it executes on
the application's behalf. For example, when writing to a socket, the
kernel copies data into its buffers, thus wasting common resources
needed by all applications. It would be better, perhaps, to "penalise"
the application by making it give up some of its resources.

sorry for this late reply. i think you're right. it should be possible
to make the kernel use the application resources. if during the system
call, u can map the application's address space into kernel virtual
address space, then the copy_from_user() and copy_to_user() can be
avoided and a simple memcpy could do the job. but then, u need to
think of situations where the application's memory are in swap.

> the stack size is actually used in many places, there is "special" data
> stored at the end of the stack that is used from all over the place (for
> example, "current" comes from there), and the way you find it is by
> knowing the stack size (4Kb or 8kb) and doing bitmasks on the stack
> pointer to calculate the top of the stack. Even if the actual memory is
> bigger than 4Kb/8Kb, this is still an issue ;)
>
> Another "fun" issue is that the kernel tends to expect you can do dma
> from the stack. if you cross the page boundary, and the 2 pages aren't
> consecutive in physical memory, that is a big problem.... because your
> DMA would need to be split which you can't really. This is also why
> doing 8Kb (or bigger) stacks in the kernel is painful, they have to by
> physically contiguous, so all the VM fragmentation issues come into full
> force.
OK, these are much bigger issues than swapping. So I guess the answer
would be "no" :-(

the debate over copy_from_user()/copy_to_user() is not new. so, you're
right. there could be much bigger issues. But the answer could not be
"no".

Thanks,

Jinesh.

Thanks for your help,
Elad

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux