Re: [PATCH 2/2 RESEND] mm: vmpressure: fix sending wrong events on underflow

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

 



On Mon, Feb 6, 2017 at 6:54 PM, Michal Hocko <mhocko@xxxxxxxxxx> wrote:
> On Mon 06-02-17 18:39:03, vinayak menon wrote:
>> On Mon, Feb 6, 2017 at 6:10 PM, Michal Hocko <mhocko@xxxxxxxxxx> wrote:
>> > On Mon 06-02-17 17:54:10, Vinayak Menon wrote:
>> > [...]
>> >> diff --git a/mm/vmpressure.c b/mm/vmpressure.c
>> >> index 149fdf6..3281b34 100644
>> >> --- a/mm/vmpressure.c
>> >> +++ b/mm/vmpressure.c
>> >> @@ -112,8 +112,10 @@ static enum vmpressure_levels vmpressure_calc_level(unsigned long scanned,
>> >>                                                   unsigned long reclaimed)
>> >>  {
>> >>       unsigned long scale = scanned + reclaimed;
>> >> -     unsigned long pressure;
>> >> +     unsigned long pressure = 0;
>> >>
>> >> +     if (reclaimed >= scanned)
>> >> +             goto out;
>> >
>> > This deserves a comment IMHO. Besides that, why shouldn't we normalize
>> > the result already in vmpressure()? Please note that the tree == true
>> > path will aggregate both scanned and reclaimed and that already skews
>> > numbers.
>> Sure. Will add a comment.
>> IIUC, normalizing in vmpressure() means something like this which you
>> mentioned in one
>> of your previous emails right ?
>>
>> + if (reclaimed > scanned)
>> +          reclaimed = scanned;
>
> yes or scanned = reclaimed.
>
>> Considering a scan window of 512 pages and without above piece of
>> code, if the first scanning is of a THP page
>> Scan=1,Reclaimed=512
>> If the next 511 scans results in 0 reclaimed pages
>> total_scan=512,Reclaimed=512 => vmpressure 0
>
> I am not sure I understand. What do you mean by next scans? We do not
> modify counters outside of vmpressure? If you mean next iteration of
> shrink_node's loop then this changeshouldn't make a difference, no?
>
By scan I meant pages scanned by shrink_node_memcg/shrink_list which is passed
as nr_scanned to vmpressure.
The calculation of pressure for tree is done at the end of
vmpressure_win and it is that
calculation which underflows. With this patch we want only the
underflow to be avoided. But
if we make (reclaimed = scanned) in vmpressure(), we change the
vmpressure value even
when there is no underflow right ?
Rewriting the above e.g again.
First call to vmpressure with nr_scanned=1 and nr_reclaimed=512 (THP)
Second call to vmpressure with nr_scanned=511 and nr_reclaimed=0
In the second call vmpr->tree_scanned becomes equal to vmpressure_win
and the work
is scheduled and it will calculate the vmpressure as 0 because
tree_reclaimed = 512

Similarly, if scanned is made equal to reclaimed in vmpressure()
itself as you had suggested,
First call to vmpressure with nr_scanned=1 and nr_reclaimed=512 (THP)
And in vmpressure, we make nr_scanned=1 and nr_reclaimed=1
Second call to vmpressure with nr_scanned=511 and nr_reclaimed=0
In the second call vmpr->tree_scanned becomes equal to vmpressure_win
and the work
is scheduled and it will calculate the vmpressure as critical, because
tree_reclaimed = 1

So it makes a difference, no?

--
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/ .
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 OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux