From owner-p4-projects Sat Oct 5 13:47: 5 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 30F5F37B404; Sat, 5 Oct 2002 13:47:02 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B95A637B401 for ; Sat, 5 Oct 2002 13:47:01 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5AE8843E65 for ; Sat, 5 Oct 2002 13:47:01 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g95Kl1Co076998 for ; Sat, 5 Oct 2002 13:47:01 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g95Kl18I076995 for perforce@freebsd.org; Sat, 5 Oct 2002 13:47:01 -0700 (PDT) Date: Sat, 5 Oct 2002 13:47:01 -0700 (PDT) Message-Id: <200210052047.g95Kl18I076995@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm Subject: PERFORCE change 18763 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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