I am trying to implement the idea that Nadav proposed to save memory when implementing callstack switch during syscall. Here is excerpt from our conversation:
" > > I was also wondering that existing implementation of syscall stack makes > every app thread allocate it upon creation eagerly whether syscall are > going to be made or not. For example java apps (which I believe use libc > functions) would be penalized by memory usage. I was wondering how > difficult it would be to make allocation of syscall stack lazily only when > first syscall is made. > The problem is that we won't have a stack to do this allocation work on. One thing we could do have for all threads a tiny syscall stack (doesn't even need to be a whole page, can be smaller!), and the first thing a syscall does is to check if this thread has this tiny stack, and if it does it allocates a different one. The stack needs to be just big enough for malloc() to run. We could even avoid calling malloc() directly and just send a message to a different thread to do this for us, but I think this will be an overkill. " So I am trying to avoid messing with assembly as much as possible. Is it possible to implement it almost all in C by calling a function from linux.cc/syscall_wrapper() that would lazily allocate larger stack? Obviously we would still need to change RSP register to new value and then restore it back with could be done with asm("...") instruction. Is it possible? -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.