Re: [RFC 1/3] /dev/low_mem_notify

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 24, 2012 at 06:08:31PM +0200, Ronen Hod wrote:
> On 01/24/2012 05:38 PM, Marcelo Tosatti wrote:
> >On Thu, Jan 19, 2012 at 10:53:29AM +0000, leonid.moiseichuk@xxxxxxxxx wrote:
> >>>-----Original Message-----
> >>>From: ext Ronen Hod [mailto:rhod@xxxxxxxxxx]
> >>>Sent: 19 January, 2012 11:20
> >>>To: Pekka Enberg
> >>...
> >>>>>>Isn't
> >>>>>>
> >>>>>>/proc/sys/vm/min_free_kbytes
> >>>>>>
> >>>>>>pretty much just that?
> >>>>>Would you suggest to use min_free_kbytes as the threshold for sending
> >>>>>low_memory_notifications to applications, and separately as a target
> >>>>>value for the applications' memory giveaway?
> >>>>I'm not saying that the kernel should use it directly but it seems
> >>>>like the kind of "ideal number of free pages" threshold you're
> >>>>suggesting. So userspace can read that value and use it as the "number
> >>>>of free pages" threshold for VM events, no?
> >>>Yes, I like it. The rules of the game are simple and consistent all over, be it the
> >>>alert threshold, voluntary poling by the apps, and for concurrent work by
> >>>several applications.
> >>>Well, as long as it provides a good indication for low_mem_pressure.
> >>For me it doesn't look that have much sense. min_free_kbytes could be set from user-space (or auto-tuned by kernel) to keep some amount
> >>of memory available for GFP_ATOMIC allocations.  In case situation comes under pointed level kernel will reclaim memory from e.g. caches.
> >>
> >>> From potential user point of view the proposed API has number of lacks which would be nice to have implemented:
> >>1. rename this API from low_mem_pressure to something more related to notification and memory situation in system: memory_pressure, memnotify, memory_level etc. The word "low" is misleading here
> >>2. API must use deferred timers to prevent use-time impact. Deferred timer will be triggered only in case HW event or non-deferrable timer, so if device sleeps timer might be skipped and that is what expected for user-space
> >Having userspace specify the "sample period" for low memory notification
> >makes no sense. The frequency of notifications is a function of the
> >memory pressure.
> >
> >>3. API should be tunable for propagate changes when level is Up or Down, maybe both ways.
> >
> >>4. to avoid triggering too much events probably has sense to filter according to amount of change but that is optional. If subscriber set timer to 1s the amount of events should not be very big.
> >>5. API must provide interface to request parameters e.g. available swap or free memory just to have some base.
> >It would make the interface easier to use if it provided the number of
> >pages to free, in the notification (kernel can calculate that as the
> >delta between current_free_pages ->  comfortable_free_pages relative to
> >process RSS).
> 
> If you rely on the notification's argument you lose several features:
>  - Handling of notifications by several applications in parallel

Each application has its argument built in a custom fashion
(pages_to_free = delta between current_free_pages ->
comfortable_free_pages relative to process RSS), or something to that
effect. It is compatible with parallel notifications.

>  - Voluntary application's decisions, such as cleanup or avoiding allocations, at the application's convenience.

I am suggesting an additional field in the notification data so that the
freeing routine has a goal. But it is not mandatory.

> - Iterative release loops, until there are enough free pages.

What is the advantage versus releasing the necessary amount of
memory in a given moment?

> I believe that the notification should only serve as a trigger to run the cleanup.

Agree.


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]