All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] Using madvise()/ioctl() instead of /dev/anon?
@ 2004-07-06 11:20 BlaisorBlade
  2004-07-13 19:29 ` Jeff Dike
  0 siblings, 1 reply; 2+ messages in thread
From: BlaisorBlade @ 2004-07-06 11:20 UTC (permalink / raw)
  To: Jeff Dike; +Cc: user-mode-linux-devel

Well, you have started implementing /dev/anon, but you where also looking for 
a better interface.

I saw the description of madvise(MADV_DONTNEED), and it seemed to be what we 
needed, but it was not, sadly (it would discard data only from anonymous 
memory); but that gave me an idea of how to go.
What you need is to discard a dirty page from a mmap'ed tmpfs file (it is not 
worth implementing it for any other case: who wants performance needs tmpfs 
anyway); that could become a new ioctl on the file.

There are two ways:
1) A ioctl meaning "discard this page", to call onto a munmap()ed page: this 
separates the munmap() and the discard, but also increases the number of 
syscalls a little. I don't know if this increase is at all harmful: I 
consider this of low importance, since this is not performance critical IMHO.
2) A ioctl meaning "discard pages on munmap from this file": this requires 
adding file_operations-> munmap, but actually seems better for us.

The problem, in both cases, is about implementing them: it's harder than 
/dev/anon, since you need to hack tmpfs, but it will be probably more stable.

By the way: have you made sure that /dev/anon memory is swappable?

I also saw one bug: shmem_file_setup is called always with "dev/anon" as 
parameter: am I overlooking something or that will break when there are 
multiple UMLs running?
-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
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] 2+ messages in thread

* Re: [uml-devel] Using madvise()/ioctl() instead of /dev/anon?
  2004-07-06 11:20 [uml-devel] Using madvise()/ioctl() instead of /dev/anon? BlaisorBlade
@ 2004-07-13 19:29 ` Jeff Dike
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2004-07-13 19:29 UTC (permalink / raw)
  To: BlaisorBlade; +Cc: user-mode-linux-devel

blaisorblade_spam@yahoo.it said:
> There are two ways: 
> 1) A ioctl meaning "discard this page", to call
> onto a munmap()ed page: this  separates the munmap() and the discard,
> but also increases the number of  syscalls a little. I don't know if
> this increase is at all harmful: I  consider this of low importance,
> since this is not performance critical IMHO. 
> 2) A ioctl meaning
> "discard pages on munmap from this file": this requires  adding
> file_operations-> munmap, but actually seems better for us. 

ioctls are frowned upon since they are inherently unstructured.  If you need
special semantics for something, a new driver/filesystem is generally preferred.

I'm not saying that hacking on tmpfs is the right way to go necessarily, but
I think it's better than adding ioctls to something.

A new madvise option might be a possibility, but I still like a special driver
better.

> By the way: have you made sure that /dev/anon memory is swappable? 

Yeah, tmpfs is swappable, and devanon does nothing to change that.

> I also saw one bug: shmem_file_setup is called always with "dev/anon"
> as  parameter: am I overlooking something or that will break when
> there are  multiple UMLs running? 

Every new open will give you a new devanon instance.  The name is just there
to give /proc/<pid>/maps and /proc/<pid>/fd something to print.

				Jeff



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2004-07-13 18:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-06 11:20 [uml-devel] Using madvise()/ioctl() instead of /dev/anon? BlaisorBlade
2004-07-13 19:29 ` 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.