All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] Re: (implementation idea) Re: uml and nonstandard memory splits?
@ 2006-03-28 20:09 Jeff Dike
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff Dike @ 2006-03-28 20:09 UTC (permalink / raw)
  To: user-mode-linux-devel

On Mon, Mar 27, 2006 at 11:33:37PM +0100, Blaisorblade wrote:
> Especially maybe_map must pin the pages (see implementation of 4G/4G 
> copy_*_user from Ingo Molnar).

Yup, looks like we can follow Ingo's implementation on this one.

> I'll work on this, I had come up with a nice design time ago, if you merge a 
> lockless filehandle I'll be glad to add locking to it. If you have a somehow 
> stable code base on it, let me know and I'll work on the patches.

I believe that the filehandle that's in my patchset is stable.  I've
beat on it with hostfs with no problems.  humfs is less healthy, but
it looks like the problems don't have anything to do with filehandle.

> My design was that you:
> a) take the list lock
> b) remove the fd from the list
> c) drop the list lock
> instead of simply bringing the fd upfront
> d) call read (or whatever) on the interested fd
> e) redo a)-c) but now to _add_ the fd on list, on the front

Which was pretty much the get_fh() and put_fh() I was considering.
It's just a pain to have to wrap that around every file access.

> This may also need a reference count if in step b) the fd may already be on 
> the list.

The scenario I think you have in mind is
	one process gets an fd for file I/O
	so does another one
	the first process finishes and sticks the thing back on the
list
	it is reclaimed, screwing the second process, which hasn't
made the system call yet

In this case, get_fh should just increment a count, put_fh should
decrement it, and the only list operation should be to move it to the
end of the list so it's last to be reclaimed.  The reclaimer would not
reclaim filehandles with non-zero counts.  I see no point in removing
it from the list and adding it back, as that seems not to protect
against anything.

> *) when _any_ fd API of the existing set (os_*) is called, it detects 
> -EMFILE/-ENFILE and closes fd's on the back of the list (i.e. we do LRU on 
> the list)

You're envisioning the os_* interfaces calling back into filehandle.c
to get a descriptor if needed?  That would make this whole thing less
"layery", which I can see.

> *) using new APIs is only needed to register an fd as "reclaimable" - this is
> optional since it can be used only for file-based fds (not for pipes, 
> probably not for sockets)

Which is how things work now, as is_reclaimable is called only when it
is known that a file has been opened.

				Jeff


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-03-28 22:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <dvv6ir$ajn$1@sea.gmane.org>
     [not found] ` <20060323235044.GA7273@ccure.user-mode-linux.org>
     [not found]   ` <20060324004052.GA1897@knob.reflex>
2006-03-24  0:56     ` [uml-devel] (implementation idea) Re: uml and nonstandard memory splits? Blaisorblade
2006-03-24  2:30       ` [uml-devel] " Jeff Dike
2006-03-24 14:34         ` Blaisorblade
2006-03-24 16:40           ` Jason Lunz
2006-03-24 17:26           ` Jeff Dike
2006-03-27 22:30             ` Blaisorblade
2006-03-28 20:02               ` Jeff Dike
2006-03-28 22:05                 ` [uml-devel] Re: [uml-user] " Blaisorblade
2006-03-28 22:09                   ` Blaisorblade
2006-03-28 20:09 [uml-devel] " Jeff Dike

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.