RE: why mprotect(PROT_SEM) ?

"Perez-Gonzalez, Inaky" <[email protected]>
Newsgroups gmane.linux.ngpt.devel
Message-ID <[email protected]>

> Well, my explanation is already outdated :(
> ...
> ...
> PROT_SEM was planned for doing this - but you can just pass 
> the value into
> mprotect(), that's all. It's not doing anything.
> 
> The futex code itself takes care for pinning the page - this goal is
> reached with get_user_pages().

> From David Howell
> Cc: Dr. Uwe Girlich; pthreads-devel
> Subject: RE: [pthreads-devel] why mprotect(PROT_SEM) ?

> That's good news then, we can remove the mprotect syscall 
> from the NGPT 
> runtime library if the kernel futex code is doing it. Still 
> might be an
> advantage in allocating the user-mode futex structs in the same page, 
> should yield less pinned pages.

Well, I am not that sure, we'd need Rusty to confirm that. AFAIK, this could
be right, as the vcache mechanism should take care of it, but I am not still
that sure we can just wipe it out [for 2.4 kernels]. 

This is what I got from Rusty - to me it clarifies it enough [I am ">",
Rusty is not indexed]:

------------------------------
> The PROT_SEM flag needs to be applied to any shared area - how we define
> shared here? [this is my last hope for simpliciation of the problem,
though
> I am pesimistic]:
> 
> - shared between _different_ processes with DIFFERENT VMAs

This one.  If it's in the same address space, you *don't* need it.

> If it were the first one, it would mean, for me, that between clones of
the
> same process I don't need to set PROT_SEM and that would simplify the
> internal spinlocks a _huge_ lot.

Yes.

> However, I don't see a reason why that
> should happen, normal processes sharing a page are the same that two
clones
> sharing all ... basically, I loose again.

Same address space: you're fine.  It's executing at a different
address, and maybe has slightly different kernel datastructures, but
it is (to futexes) the same program.
---------------------------

So, PROT_SEM needed for 2.4, no PROT_SEM needed for 2.5? that's the
question. 

Inaky Perez-Gonzalez -- Not speaking for Intel - opinions are my own [or my
fault]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.