Re: [PATCH 2/2] [RFC] fadvise: Add _VOLATILE,_ISVOLATILE, and _NONVOLATILE flags

John Stultz
2012-02-17T03:49:43Z

On Sun, 2012-02-12 at 15:08 +0100, Dmitry Adamushko wrote:
> On 10 February 2012 01:16, John Stultz <john.stultz@linaro.org> wrote:
> Also, I have a question about mapping_range_volatile().
[snip]
> + new->mapping = mapping;
> + new->range_node.start = start;
> + new->range_node.end = end;
> + new->purged = purged;
>
> I'm wondering whether this 'inheritance' is always desirable.
>
> Say,
>
> mapping_range_volatile(mapping, X, X + 1);
> ...
> time goes by and volatile_shrink() has been called for this region.
>
> now, a user does the following (is it considered bad user-behavior?)
>
> mapping_range_volatile(mapping, Y = X - big_value, Z = X + big_value);
>
> This new range will 'inherit' purged=1 from the old one and won't be
> on the lru_list. Yet, it's much bigger than the old one and so many
> pages are not really 'volatile'.

Yea, I think this is a interesting point, and we can probably be a
little smarter then what is done here. We could only coalesce ranges
that haven't been purged, for instance. Although, the coalescing of
neighboring ranges in of itself is sort of questionable, as if they were
marked volatile independently, they may be marked nonvolatile
independently as well, so merging them together mucks up the lru
ordering.

Robert/Brian: Is there strong rational for the coalescing of neighboring
ranges in ashmem?

thanks
-john