Re: [PATCH v2] ummunotify: Userspace support for MMU notifications

From: Roland Dreier
Date: Tue Jul 28 2009 - 12:14:49 EST



> > +config UMMUNOTIFY
> > + tristate "Userspace MMU notifications"
> > + select MMU_NOTIFIER

> Does `select' dtrt here if UMMUNOTIFY=m? I never trust it...

Yes, it appears to when I test... and all the other users (KVM, SGI_GRU)
of MMU_NOTIFIER are tristates that select it, so in practice it seems to
work as well.

> <searches in vain for ummunotify.txt>
>
> Oh well :(
>
> A little test app would be nice - I assume you have one. We could toss
> in in the tree as a how-to-use example, and people could perhaps turn
> it into a regression test - perhaps the LTP people would take it.

I'll write up a bit of doc and stick it in Documentation/ummunotify.txt,
and create samples/ummunotify/ as well for the next iteration.

> > + if (test_bit(UMMUNOTIFY_FLAG_HINT, &reg->flags)) {
> > + clear_bit(UMMUNOTIFY_FLAG_HINT, &reg->flags);
> > + } else {
> > + set_bit(UMMUNOTIFY_FLAG_HINT, &reg->flags);

> It's a shame that change_bit() didn't return the old (or new) value.

Heh, I didn't know about change_bit(). <looks> ... seems like
test_and_change_bit() is exactly what would fit here. Will update.

> The overall userspace interface seems a bit klunky, but I can't really
> suggest anything better. Netlink delivery?

I took a quick look at netlink but discarded the idea when I saw that
netlink sockets don't support mmap() ... seems that plumbing in mmap
support (to handle the kernel exported generation count) is probably
more trouble than it's worth, and I'm not sure that all the netlink
encapsulation is that much of a win here anyway. I'd prefer to proceed
with the "virtual character device" interface -- another option would be
sys_ummunotify_create and sys_ummunotify_ctl but I can't really imagine
this being worth another couple syscalls.

- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/