[PATCH v5 9/9] memcg: check memcg dirty limits in page writeback

Greg Thelen gthelen at google.com
Thu Mar 3 16:30:23 PST 2011


On Wed, Mar 2, 2011 at 3:17 PM, Vivek Goyal <vgoyal at redhat.com> wrote:
> On Fri, Feb 25, 2011 at 01:36:00PM -0800, Greg Thelen wrote:
>
> [..]
>> @@ -500,18 +527,27 @@ static void balance_dirty_pages(struct address_space *mapping,
>>               };
>>
>>               global_dirty_info(&sys_info);
>> +             if (!memcg_dirty_info(NULL, &memcg_info))
>> +                     memcg_info = sys_info;
>>
>>               /*
>>                * Throttle it only when the background writeback cannot
>>                * catch-up. This avoids (excessively) small writeouts
>>                * when the bdi limits are ramping up.
>>                */
>> -             if (dirty_info_reclaimable(&sys_info) + sys_info.nr_writeback <=
>> +             if ((dirty_info_reclaimable(&sys_info) +
>> +                  sys_info.nr_writeback <=
>>                               (sys_info.background_thresh +
>> -                              sys_info.dirty_thresh) / 2)
>> +                              sys_info.dirty_thresh) / 2) &&
>> +                 (dirty_info_reclaimable(&memcg_info) +
>> +                  memcg_info.nr_writeback <=
>> +                             (memcg_info.background_thresh +
>> +                              memcg_info.dirty_thresh) / 2))
>>                       break;
>>
>> -             bdi_thresh = bdi_dirty_limit(bdi, sys_info.dirty_thresh);
>> +             bdi_thresh = bdi_dirty_limit(bdi,
>> +                             min(sys_info.dirty_thresh,
>> +                                 memcg_info.dirty_thresh));
>>               bdi_thresh = task_dirty_limit(current, bdi_thresh);
>
> Greg, so currently we seem to have per_bdi/per_task dirty limits and
> now with this patch it will sort of become per_cgroup/per_bdi/per_task
> dirty limits? I think that kind of makes sense to me.
>
> Thanks
> Vivek
>

Vivek,  you are correct.  This patch adds per_cgroup limits to the
existing system, bdi, and system dirty memory limits.


More information about the Containers mailing list