Re: [PATCH v2] mm, memcg: skip killing processes under memcg protection at first scan

Yafang Shao
2019-08-21T08:46:39Z

On Wed, Aug 21, 2019 at 4:34 PM Michal Hocko <mhocko@suse.com> wrote:
>
> On Wed 21-08-19 16:15:54, Yafang Shao wrote:
> > On Wed, Aug 21, 2019 at 4:05 PM Michal Hocko <mhocko@suse.com> wrote:
> > >
> > > On Wed 21-08-19 15:26:56, Yafang Shao wrote:
> > > > On Wed, Aug 21, 2019 at 2:44 PM Michal Hocko <mhocko@suse.com> wrote:
> > > > >
> > > > > On Wed 21-08-19 09:00:39, Yafang Shao wrote:
> > > > > [...]
> > > > > > More possible OOMs is also a strong side effect (and it prevent us
> > > > > > from using it).
> > > > >
> > > > > So why don't you use low limit if the guarantee side of min limit is too
> > > > > strong for you?
> > > >
> > > > Well, I don't know what the best-practice of memory.min is.
> > >
> > > It is really a workload reclaim protection. Say you have a memory
> > > consumer which performance characteristics would be noticeably disrupted
> > > by any memory reclaim which then would lead to SLA disruption. This is a
> > > strong requirement/QoS feature and as such comes with its demand on
> > > configuration.
> > >
> > > > In our plan, we want to use it to protect the top priority containers
> > > > (e.g. set the memory.min same with memory limit), which may latency
> > > > sensive. Using memory.min may sometimes decrease the refault.
> > > > If we set it too low, it may useless, becasue what memory.min is
> > > > protecting is not specified. And if there're some busrt anon memory
> > > > allocate in this memcg, the memory.min may can't protect any file
> > > > memory.
> > >
> > > I am still not seeing why you are considering guarantee (memory.min)
> > > rather than best practice (memory.low) here?
> >
> > Let me show some examples for you.
> > Suppose we have three containers with different priorities, which are
> > high priority, medium priority and low priority.
> > Then we set memory.low to these containers as bellow,
> > high prioirty: memory.low same with memory.max
> > medium priroity: memory.low is 50% of memory.max
> > low priority: memory.low is 0
> >
> > When all relcaimable pages withouth protection are reclaimed, the
> > reclaimer begins to reclaim the protected pages, but unforuantely it
> > desn't know which pages are belonging to high priority container and
> > which pages are belonging to medium priority container. So the
> > relcaimer may reclaim the high priority contianer first, and without
> > reclaiming the medium priority container at all.
>
> Hmm, it is hard to comment on this configuration without knowing what is
> the overall consumption of all the three. In any case reclaiming all of
> the reclaimable memory means that you have actually reclaimed full of
> the low and half of the medium container to even start hitting on high
> priority one. When there are only low priority protected containers then
> they will get reclaimed proportionally to their size.

Right.
I think priority-based reclaimer (different priorities has differecnt
proportional scan count ) would be more fine, while memroy.low is not
easy to practice in this situation.

Thanks
Yafang