Date: Sat, 5 Oct 2002 13:47:01 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 18763 for review Message-ID: <200210052047.g95Kl18I076995@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=18763 Change 18763 by peter@peter_mckinley on 2002/10/05 13:46:31 update for the altkstack stuff. pmap_{new,dispose}_altkstack() appear to be MI - cut/pasted here. Affected files ... .. //depot/projects/ia64/sys/ia64/ia64/pmap.c#37 edit Differences ... ==== //depot/projects/ia64/sys/ia64/ia64/pmap.c#37 (text+ko) ==== @@ -757,21 +757,31 @@ return 0; } +#ifndef KSTACK_MAX_PAGES +#define KSTACK_MAX_PAGES 32 +#endif + /* * Create the KSTACK for a new thread. * This routine directly affects the fork perf for a process/thread. */ void -pmap_new_thread(struct thread *td) +pmap_new_thread(struct thread *td, int pages) { vm_offset_t *ks; + /* Bounds check */ + if (pages <= 1) + pages = KSTACK_PAGES; + else if (pages > KSTACK_MAX_PAGES) + pages = KSTACK_MAX_PAGES; + /* * Use contigmalloc for user area so that we can use a region * 7 address for it which makes it impossible to accidentally * lose when recording a trapframe. */ - ks = contigmalloc(KSTACK_PAGES * PAGE_SIZE, M_PMAP, + ks = contigmalloc(pages * PAGE_SIZE, M_PMAP, M_WAITOK, 0ul, 256*1024*1024 - 1, @@ -783,6 +793,7 @@ KSTACK_PAGES); td->td_md.md_kstackvirt = ks; td->td_kstack = IA64_PHYS_TO_RR7(ia64_tpa((u_int64_t)ks)); + td->td_kstack_pages = pages; } /* @@ -792,12 +803,45 @@ void pmap_dispose_thread(struct thread *td) { - contigfree(td->td_md.md_kstackvirt, KSTACK_PAGES * PAGE_SIZE, M_PMAP); + int pages; + + pages = td->td_kstack_pages; + contigfree(td->td_md.md_kstackvirt, pages * PAGE_SIZE, M_PMAP); td->td_md.md_kstackvirt = 0; td->td_kstack = 0; } /* + * Set up a variable sized alternate kstack. This appears to be MI. + */ +void +pmap_new_altkstack(struct thread *td, int pages) +{ + + /* shuffle the original stack */ + td->td_altkstack_obj = td->td_kstack_obj; + td->td_altkstack = td->td_kstack; + td->td_altkstack_pages = td->td_kstack_pages; + + pmap_new_thread(td, pages); +} + +void +pmap_dispose_altkstack(struct thread *td) +{ + + pmap_dispose_thread(td); + + /* restore the original kstack */ + td->td_kstack = td->td_altkstack; + td->td_kstack_obj = td->td_altkstack_obj; + td->td_kstack_pages = td->td_altkstack_pages; + td->td_altkstack = 0; + td->td_altkstack_obj = NULL; + td->td_altkstack_pages = 0; +} + +/* * Allow the KSTACK for a thread to be prejudicially paged out. */ void To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210052047.g95Kl18I076995>