Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-28 Thread Michal Hocko
On Fri 26-02-21 16:56:28, Tim Chen wrote: > > > On 2/26/21 12:52 AM, Michal Hocko wrote: > > >> > >> Michal, > >> > >> Let's take an extreme case where memcg 1 always generate the > >> first event and memcg 2 generates the rest of 128*8-1 events > >> and the pattern repeat. > > > > I do not fol

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-26 Thread Tim Chen
On 2/26/21 12:52 AM, Michal Hocko wrote: >> >> Michal, >> >> Let's take an extreme case where memcg 1 always generate the >> first event and memcg 2 generates the rest of 128*8-1 events >> and the pattern repeat. > > I do not follow. Events are per-memcg, aren't they? > __this_cpu_read(m

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-26 Thread Michal Hocko
On Thu 25-02-21 14:48:58, Tim Chen wrote: > > > On 2/24/21 3:53 AM, Michal Hocko wrote: > > On Mon 22-02-21 11:48:37, Tim Chen wrote: > >> > >> > >> On 2/22/21 11:09 AM, Michal Hocko wrote: > >> > > I actually have tried adjusting the threshold but found that it doesn't > work wel

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-25 Thread Tim Chen
On 2/24/21 3:53 AM, Michal Hocko wrote: > On Mon 22-02-21 11:48:37, Tim Chen wrote: >> >> >> On 2/22/21 11:09 AM, Michal Hocko wrote: >> I actually have tried adjusting the threshold but found that it doesn't work well for the case with unenven memory access frequency betwee

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-25 Thread Tim Chen
On 2/22/21 9:41 AM, Tim Chen wrote: > > > On 2/22/21 12:40 AM, Michal Hocko wrote: >> On Fri 19-02-21 10:59:05, Tim Chen wrote: > occurrence. Soft limit is evaluated every THRESHOLDS_EVENTS_TARGET * SOFTLIMIT_EVENTS_TARGET. If all events correspond with a newly charged me

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-24 Thread Michal Hocko
On Mon 22-02-21 11:48:37, Tim Chen wrote: > > > On 2/22/21 11:09 AM, Michal Hocko wrote: > > >> > >> I actually have tried adjusting the threshold but found that it doesn't > >> work well for > >> the case with unenven memory access frequency between cgroups. The soft > >> limit for the low me

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-22 Thread Tim Chen
On 2/22/21 11:09 AM, Michal Hocko wrote: >> >> I actually have tried adjusting the threshold but found that it doesn't work >> well for >> the case with unenven memory access frequency between cgroups. The soft >> limit for the low memory event cgroup could creep up quite a lot, exceeding >>

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-22 Thread Tim Chen
On 2/22/21 11:09 AM, Michal Hocko wrote: > On Mon 22-02-21 09:41:00, Tim Chen wrote: >> >> >> On 2/22/21 12:40 AM, Michal Hocko wrote: >>> On Fri 19-02-21 10:59:05, Tim Chen wrote: >> occurrence. > > Soft limit is evaluated every THRESHOLDS_EVENTS_TARGET * > SOFTLIMIT_EVENTS_TARGET

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-22 Thread Michal Hocko
On Mon 22-02-21 09:41:00, Tim Chen wrote: > > > On 2/22/21 12:40 AM, Michal Hocko wrote: > > On Fri 19-02-21 10:59:05, Tim Chen wrote: > occurrence. > >>> > >>> Soft limit is evaluated every THRESHOLDS_EVENTS_TARGET * > >>> SOFTLIMIT_EVENTS_TARGET. > >>> If all events correspond with a newly ch

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-22 Thread Tim Chen
On 2/22/21 12:40 AM, Michal Hocko wrote: > On Fri 19-02-21 10:59:05, Tim Chen wrote: occurrence. >>> >>> Soft limit is evaluated every THRESHOLDS_EVENTS_TARGET * >>> SOFTLIMIT_EVENTS_TARGET. >>> If all events correspond with a newly charged memory and the last event >>> was just about the soft

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-22 Thread Michal Hocko
On Fri 19-02-21 10:59:05, Tim Chen wrote: > > > On 2/19/21 1:11 AM, Michal Hocko wrote: > > On Wed 17-02-21 12:41:35, Tim Chen wrote: > > >> Memory is accessed at a much lower frequency > >> for the second cgroup. The memcg event update was not triggered for the > >> second cgroup as the memcg

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-20 Thread Tim Chen
On 2/19/21 10:59 AM, Tim Chen wrote: > > > On 2/19/21 1:11 AM, Michal Hocko wrote: >> >> Soft limit is evaluated every THRESHOLDS_EVENTS_TARGET * >> SOFTLIMIT_EVENTS_TARGET. >> If all events correspond with a newly charged memory and the last event >> was just about the soft limit boundary t

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-19 Thread Tim Chen
On 2/19/21 1:11 AM, Michal Hocko wrote: > On Wed 17-02-21 12:41:35, Tim Chen wrote: >> Memory is accessed at a much lower frequency >> for the second cgroup. The memcg event update was not triggered for the >> second cgroup as the memcg event update didn't happened on the 1024th sample. >> The

Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-19 Thread Michal Hocko
On Wed 17-02-21 12:41:35, Tim Chen wrote: > To rate limit updates to the mem cgroup soft limit tree, we only perform > updates every SOFTLIMIT_EVENTS_TARGET (defined as 1024) memory events. > > However, this sampling based updates may miss a critical update: i.e. when > the mem cgroup first exceed

[PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

2021-02-17 Thread Tim Chen
To rate limit updates to the mem cgroup soft limit tree, we only perform updates every SOFTLIMIT_EVENTS_TARGET (defined as 1024) memory events. However, this sampling based updates may miss a critical update: i.e. when the mem cgroup first exceeded its limit but it was not on the soft limit tree.