Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-16 Thread KOSAKI Motohiro
Hi > > I'd read mem_notify as "tell me when new memory is unplugged" or > > something. /dev/oom_notify? Plus, /dev/ names usually do not have "_" > > in them. > > I don't think we should use oom in the name, since the notification is > sent long before oom. OK, I don't change name. Of cource, I

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-16 Thread Daniel SpÄng
On 1/16/08, Pavel Machek <[EMAIL PROTECTED]> wrote: > On Wed 2008-01-16 02:13:32, Marcelo Tosatti wrote: > > On Wed, Jan 16, 2008 at 10:57:16AM +0900, KOSAKI Motohiro wrote: > > > Hi Pavel > > > > > > > > err = poll(&pollfds, 1, -1); // wake up at low memory > > > > > > > > > > ...

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-16 Thread Pavel Machek
On Wed 2008-01-16 02:13:32, Marcelo Tosatti wrote: > On Wed, Jan 16, 2008 at 10:57:16AM +0900, KOSAKI Motohiro wrote: > > Hi Pavel > > > > > > err = poll(&pollfds, 1, -1); // wake up at low memory > > > > > > > > ... > > > > > > > > > > Nice, this is really needed for openmoko,

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-15 Thread Marcelo Tosatti
On Wed, Jan 16, 2008 at 10:57:16AM +0900, KOSAKI Motohiro wrote: > Hi Pavel > > > > err = poll(&pollfds, 1, -1); // wake up at low memory > > > > > > ... > > > > > > > Nice, this is really needed for openmoko, zaurus, etc > > > > But this changelog needs to go into Documentation/

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-15 Thread KOSAKI Motohiro
Hi Alan > > > It also appears there is no way to wait for memory shortages (processes > > > that can free memory easily) only for memory to start appearing. > > > > poll() with never timeout don't fill your requirement? > > to be honest, maybe I don't understand your afraid yet. sorry. > > My mi

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-15 Thread KOSAKI Motohiro
Hi Pavel > > err = poll(&pollfds, 1, -1); // wake up at low memory > > > > ... > > > > Nice, this is really needed for openmoko, zaurus, etc > > But this changelog needs to go into Documentation/... > > ...and /dev/mem_notify is really a bad name. /dev/memory_low? > /dev/oom?

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-15 Thread Pavel Machek
Hi! > the core of this patch series. > add /dev/mem_notify device for notification low memory to user process. > > > > fd = open("/dev/mem_notify", O_RDONLY); > if (fd < 0) { > exit(1); > } > pollfds.fd = fd; > pollfds.events = POLLIN; >

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-15 Thread Alan Cox
> Tasks are added to the end of waitqueue->task_list through > add_wait_queue_exclusive, and waken up from the start of the list. So > I don't think that can happen (its FIFO). Agreed -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROT

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-15 Thread Alan Cox
> current wake up order is simply FIFO by poll(2) called. > because the VM cannot know how much amount each process can do in free. > the process rss and freeable memory is not proportional. Ok this makes sense. > > thus I adopt wake up one after another until restoration memory shortage. > > >

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-15 Thread Marcelo Tosatti
Hi Alan, On Tue, Jan 15, 2008 at 11:20:27AM +, Alan Cox wrote: > On Tue, 15 Jan 2008 19:59:02 +0900 > KOSAKI Motohiro <[EMAIL PROTECTED]> wrote: > > > > > > > the core of this patch series. > > > > add /dev/mem_notify device for notification low memory to user process. > > > > > > As you on

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-15 Thread KOSAKI Motohiro
Hi Alan thank you for kindfull explain. > > > > the core of this patch series. > > > > add /dev/mem_notify device for notification low memory to user process. > > > > > > As you only wake one process how would you use this API from processes > > > which want to monitor and can free memory under

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-15 Thread Alan Cox
On Tue, 15 Jan 2008 19:59:02 +0900 KOSAKI Motohiro <[EMAIL PROTECTED]> wrote: > > > > the core of this patch series. > > > add /dev/mem_notify device for notification low memory to user process. > > > > As you only wake one process how would you use this API from processes > > which want to moni

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-15 Thread KOSAKI Motohiro
> > the core of this patch series. > > add /dev/mem_notify device for notification low memory to user process. > > As you only wake one process how would you use this API from processes > which want to monitor and can free memory under load. Also what fairness > guarantees are there... Sorry, I

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-15 Thread Alan Cox
On Tue, 15 Jan 2008 10:01:21 +0900 KOSAKI Motohiro <[EMAIL PROTECTED]> wrote: > the core of this patch series. > add /dev/mem_notify device for notification low memory to user process. As you only wake one process how would you use this API from processes which want to monitor and can free memory

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-14 Thread Rik van Riel
On Tue, 15 Jan 2008 11:20:56 +0900 KOSAKI Motohiro <[EMAIL PROTECTED]> wrote: > Hi Kame > > > > + if (pressure) { > > > + nr_wakeup = max_t(int, atomic_read(&nr_watcher_task)>>4, 100); > > > + atomic_long_set(&last_mem_notify, jiffies); > > > + wake_up_locked_nr(&mem_wait,

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-14 Thread KOSAKI Motohiro
Hi Kame > > + if (pressure) { > > + nr_wakeup = max_t(int, atomic_read(&nr_watcher_task)>>4, 100); > > + atomic_long_set(&last_mem_notify, jiffies); > > + wake_up_locked_nr(&mem_wait, nr_wakeup); > > + } > What is this for ? and Why ? > Are there too many waiters

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-14 Thread KAMEZAWA Hiroyuki
On Tue, 15 Jan 2008 10:01:21 +0900 KOSAKI Motohiro <[EMAIL PROTECTED]> wrote: > + if (pressure) { > + nr_wakeup = max_t(int, atomic_read(&nr_watcher_task)>>4, 100); > + atomic_long_set(&last_mem_notify, jiffies); > + wake_up_locked_nr(&mem_wait, nr_wakeup);

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-14 Thread KOSAKI Motohiro
Hi > > 1/ I don't see the file below listed in the diffstat above... > > Agghh... > sorry, it is mistake. > I repost soon. > > thanks. the below diffstat is correct. thanks! -- Documentation/devices.txt |1 drivers/char/mem.c |6 ++ include/linux/

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-14 Thread KOSAKI Motohiro
Hi randy > Hi, > > 1/ I don't see the file below listed in the diffstat above... Agghh... sorry, it is mistake. I repost soon. thanks. > 2/ Where is the userspace interface information for the syscall? No. userspace interface is only poll(2). -- To unsubscribe from this list: send the li

Re: [RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-14 Thread Randy Dunlap
On Tue, 15 Jan 2008 10:01:21 +0900 KOSAKI Motohiro wrote: > the core of this patch series. > add /dev/mem_notify device for notification low memory to user process. > > > > fd = open("/dev/mem_notify", O_RDONLY); > if (fd < 0) { > exit(1); > } > p

[RFC][PATCH 3/5] add /dev/mem_notify device

2008-01-14 Thread KOSAKI Motohiro
the core of this patch series. add /dev/mem_notify device for notification low memory to user process. fd = open("/dev/mem_notify", O_RDONLY); if (fd < 0) { exit(1); } pollfds.fd = fd; pollfds.events = POLLIN; pollfds.revents = 0;