Date: Sun, 15 Dec 1996 11:28:31 -0500 (EST) From: "John S. Dyson" <toor@dyson.iquest.net> To: phk@critter.tfs.com (Poul-Henning Kamp) Cc: peter@spinner.dialix.com, dyson@freebsd.org, smp@freebsd.org, haertel@ichips.intel.com Subject: Re: some questions concerning TLB shootdowns in FreeBSD Message-ID: <199612151628.LAA05010@dyson.iquest.net> In-Reply-To: <9319.850645034@critter.tfs.com> from "Poul-Henning Kamp" at Dec 15, 96 11:17:14 am
next in thread | previous in thread | raw e-mail | index | archive | help
> > In message <199612151003.SAA14741@spinner.DIALix.COM>, Peter Wemm writes: > >Poul-Henning Kamp wrote: > >> In message <199612150121.JAA12763@spinner.DIALix.COM>, Peter Wemm writes: > >> > >> >However, the shared address space code that I was working on in > >> >-current (for kernel assisted threading in the smp kernel) means > >> >that a single vmspace/pmap/etc can be shared among multiple processes > >> >and this changes the above picture since two cpu's can be using > >> >the user mode parts of the same page tables at once, one in executing > >> >in user mode, one in the kernel. > >> > >> But we could still have a per-cpu flags: > >> "I'm not in a shared address-space" > >> > >> Ie, this would only be set if the CPU was in userland in a non-threaded > >> process. > > > >eg, something like: > >if (is_userland && curproc->p_vmspace->vm_refcnt > 1) > > send_tlb_invalidate(); > > Well more like: > > for (i=0;i<NCPU;i++) > if (is_userland(i) && curproc[i]->p_vmspace->vm_refcnt > 1) > send_tlb_invalidate(i); > This won't work because processes seldom have the entire address space shared (vm_refcnt.) I am sure that when we get true kernel multithreading that will not be true though. In order to test if a section of an address space is shared, you have to do something like this (and this can take LOTS of time.) (I might have levels of indirection off here, I am also not taking into account submaps -- which complicate the code further, by entailing recursively calling the map/object traversal again -- but recursion is a major no-no in the kernel, as we have found.) for(i=0;i<NCPU;i++) { tmpe = &curproc[i]->p_vmspace->vm_map->header.next; while (tmpe != &map->header) { if ((tmpe->is_sub_map == 0) && (tmpe->is_a_map == 0)) { tobj = tmpe->object.vm_object; while(tobj) { if (tobj->ref_count > 1) { send_tlb_invalidate(i); goto nextcpu; } tobj = tobj->backing_object; } } else { /* * here on a new map -- need to recurse or * somesuch here -- yuck!!! */ } tmpe = tmpe->next; } nextcpu: } John
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612151628.LAA05010>