On 4/19/21 5:11 PM, Johannes Weiner wrote:

BTW, have you ever thought of moving the cgroup-v1 specific functions out
into a separate memcontrol-v1.c file just like kernel/cgroup/cgroup-v1.c?

I thought of that before, but memcontrol.c is a frequently changed file and
so a bit hard to do.
I haven't looked too deeply at it so far, but I think it would make
sense to try.

There are indeed many of the entry paths from the MM code that are
shared between cgroup1 and cgroup2, with smaller branches here and
there to adjust behavior. Those would throw conflicts, but those we
should probably keep in the main memcontrol.c for readability anyway.

But there is also plenty of code that is exclusively about cgroup1,
and which actually doesn't change much in a long time. Moving that
elsewhere shouldn't create difficult conflicts - maybe a few line
offset warnings or fuzz-- Rafael


  in the diff context of unrelated changes:

- the soft limit tree and soft limit reclaim

- the threshold and oom event notification stuff

- the charge moving code

- remaining v1 interface files, as well as their helper functions

 From a quick scan, this adds up to ~2,500 lines of old code with no
actual dependencies from the common code or from v2, and which could
be moved out of the way without disrupting ongoing development much.

Right.

Currently memcontrol.c has over 7000 lines of code and keep growing. That makes it harder to read, navigate and update. If we can cut out 2000 lines or more from memcontrol.c, it will make it more manageable.

Cheers,
Longman

Reply via email to