mbox series

[0/4] Backport MEMCG changes from v5.17

Message ID 20220712112238.18824-1-goliath@infraroot.at
Headers show
Series Backport MEMCG changes from v5.17 | expand

Message

David Oberhollenzer July 12, 2022, 11:22 a.m. UTC
This is a backport of Sebastian's MEMCG changes to v5.15. With these
patches applied, it is possible to use memory cgroups together
with PREEMPT_RT on v5.15, just like on v5.17.

David Oberhollenzer (1):
  Allow MEMCG on PREEMPT_RT

Sebastian Andrzej Siewior (3):
  mm/memcg: Disable threshold event handlers on PREEMPT_RT
  mm/memcg: Protect per-CPU counter by disabling preemption on
    PREEMPT_RT where needed.
  mm/memcg: Add a local_lock_t for IRQ and TASK object.

 .../admin-guide/cgroup-v1/memory.rst          |    2 +
 init/Kconfig                                  |    1 -
 mm/memcontrol.c                               | 1264 +++++++++--------
 3 files changed, 671 insertions(+), 596 deletions(-)

Comments

Joseph Salisbury July 27, 2022, 8:35 p.m. UTC | #1
On 7/12/22 07:22, David Oberhollenzer wrote:
> This is a backport of Sebastian's MEMCG changes to v5.15. With these
> patches applied, it is possible to use memory cgroups together
> with PREEMPT_RT on v5.15, just like on v5.17.
>
> David Oberhollenzer (1):
>    Allow MEMCG on PREEMPT_RT
>
> Sebastian Andrzej Siewior (3):
>    mm/memcg: Disable threshold event handlers on PREEMPT_RT
>    mm/memcg: Protect per-CPU counter by disabling preemption on
>      PREEMPT_RT where needed.
>    mm/memcg: Add a local_lock_t for IRQ and TASK object.
>
>   .../admin-guide/cgroup-v1/memory.rst          |    2 +
>   init/Kconfig                                  |    1 -
>   mm/memcontrol.c                               | 1264 +++++++++--------
>   3 files changed, 671 insertions(+), 596 deletions(-)
>
Hi David,

Do you know if these patches will be merged into the 5.15 patchset?

Thanks,

Joe
Sebastian Andrzej Siewior July 29, 2022, 4:14 p.m. UTC | #2
On 2022-07-27 16:35:44 [-0400], Joseph Salisbury wrote:
> Hi David,
Hi,

> Do you know if these patches will be merged into the 5.15 patchset?

I'm going to look at these next week. Has this been tested?

> Thanks,
> 
> Joe

Sebastian
Joseph Salisbury July 29, 2022, 4:37 p.m. UTC | #3
On 7/29/22 12:14, Sebastian Andrzej Siewior wrote:
> On 2022-07-27 16:35:44 [-0400], Joseph Salisbury wrote:
>> Hi David,
> Hi,
>
>> Do you know if these patches will be merged into the 5.15 patchset?
> I'm going to look at these next week. Has this been tested?
Thanks for the update, Sebastian!  I have not tested the patches 
myself.  There is an open Ubuntu kernel bug[0].  I can build a test 
kernel for the bug reporter and ask them to test.  I will provide 
testing results to this thread.
>
>> Thanks,
>>
>> Joe
> Sebastian


[0] http://pad.lv/1978814
Joseph Salisbury Aug. 1, 2022, 6:17 p.m. UTC | #4
On 7/29/22 12:14, Sebastian Andrzej Siewior wrote:
> On 2022-07-27 16:35:44 [-0400], Joseph Salisbury wrote:
>> Hi David,
> Hi,
>
>> Do you know if these patches will be merged into the 5.15 patchset?
> I'm going to look at these next week. Has this been tested?
If anyone is interested in testing these patches with the Ubuntu distro, 
I created a 5.15.39 based test kernel which is packaged as a .deb. This 
test kernel has the rt-42 patch set, and the four patches from David.
This test kernel can be downloaded from:
https://people.canonical.com/~jsalisbury/MEMCG_UNSUPPORTED_TEST_KERNEL/

This kernel will also be tested in an Ubuntu kernel bug[0].  The bug 
reporter will be testing if the patches resolve a bug that affects 
kubernetes, which is missing cgroup memory.  However, the bug reporter 
will probably not be testing latency differences.  That is something I 
could look into next week.

Joe

[0] http://pad.lv/1978814
>
>> Thanks,
>>
>> Joe
> Sebastian
Joseph Salisbury Aug. 1, 2022, 10:36 p.m. UTC | #5
On 8/1/22 14:17, Joseph Salisbury wrote:
>
>
> On 7/29/22 12:14, Sebastian Andrzej Siewior wrote:
>> On 2022-07-27 16:35:44 [-0400], Joseph Salisbury wrote:
>>> Hi David,
>> Hi,
>>
>>> Do you know if these patches will be merged into the 5.15 patchset?
>> I'm going to look at these next week. Has this been tested?
> If anyone is interested in testing these patches with the Ubuntu 
> distro, I created a 5.15.39 based test kernel which is packaged as a 
> .deb. This test kernel has the rt-42 patch set, and the four patches 
> from David.
> This test kernel can be downloaded from:
> https://people.canonical.com/~jsalisbury/MEMCG_UNSUPPORTED_TEST_KERNEL/
Also, the test kernel is AMD64.  If anyone needs an ARM64 kernel, just 
let me know.
>
> This kernel will also be tested in an Ubuntu kernel bug[0].  The bug 
> reporter will be testing if the patches resolve a bug that affects 
> kubernetes, which is missing cgroup memory.  However, the bug reporter 
> will probably not be testing latency differences. That is something I 
> could look into next week.
>
> Joe
>
> [0] http://pad.lv/1978814
>>
>>> Thanks,
>>>
>>> Joe
>> Sebastian
>
Clark Williams Aug. 2, 2022, 12:28 p.m. UTC | #6
I'm currently working through some conflicts when I merged Greg's
v5.15.58 into the 5.15-rt stable tree, but I'd be very interesting in
testing in your patch after I get that resolved.

Clark

On Mon, Aug 1, 2022 at 10:36 PM Joseph Salisbury
<joseph.salisbury@canonical.com> wrote:
>
>
>
> On 8/1/22 14:17, Joseph Salisbury wrote:
> >
> >
> > On 7/29/22 12:14, Sebastian Andrzej Siewior wrote:
> >> On 2022-07-27 16:35:44 [-0400], Joseph Salisbury wrote:
> >>> Hi David,
> >> Hi,
> >>
> >>> Do you know if these patches will be merged into the 5.15 patchset?
> >> I'm going to look at these next week. Has this been tested?
> > If anyone is interested in testing these patches with the Ubuntu
> > distro, I created a 5.15.39 based test kernel which is packaged as a
> > .deb. This test kernel has the rt-42 patch set, and the four patches
> > from David.
> > This test kernel can be downloaded from:
> > https://people.canonical.com/~jsalisbury/MEMCG_UNSUPPORTED_TEST_KERNEL/
> Also, the test kernel is AMD64.  If anyone needs an ARM64 kernel, just
> let me know.
> >
> > This kernel will also be tested in an Ubuntu kernel bug[0].  The bug
> > reporter will be testing if the patches resolve a bug that affects
> > kubernetes, which is missing cgroup memory.  However, the bug reporter
> > will probably not be testing latency differences. That is something I
> > could look into next week.
> >
> > Joe
> >
> > [0] http://pad.lv/1978814
> >>
> >>> Thanks,
> >>>
> >>> Joe
> >> Sebastian
> >
>
Sebastian Andrzej Siewior Aug. 3, 2022, 6:53 a.m. UTC | #7
On 2022-07-12 13:22:34 [+0200], David Oberhollenzer wrote:
> This is a backport of Sebastian's MEMCG changes to v5.15. With these
> patches applied, it is possible to use memory cgroups together
> with PREEMPT_RT on v5.15, just like on v5.17.

This isn't the series that was merged upstream:
| 0001-mm-memcg-Revert-mm-memcg-optimize-user-context-objec.patch
| 0002-mm-memcg-Disable-threshold-event-handlers-on-PREEMPT.patch
| 0003-mm-memcg-Protect-per-CPU-counter-by-disabling-preemp.patch
| 0004-mm-memcg-Opencode-the-inner-part-of-obj_cgroup_uncha.patch
| 0005-mm-memcg-Protect-memcg_stock-with-a-local_lock_t.patch
| 0006-mm-memcg-Disable-migration-instead-of-preemption-in-.patch
| 0007-mm-memcg-Add-missing-counter-index-which-are-not-upd.patch
| 0008-mm-memcg-Add-a-comment-regarding-the-release-obj.patch
| mm-memcg-Only-perform-the-debug-checks-on-PREEMPT_RT.patch

any reason why not backport those?

Sebastian
David Oberhollenzer Aug. 3, 2022, 9:17 a.m. UTC | #8
Hi Sebastian,

On 8/3/22 08:53, Sebastian Andrzej Siewior wrote:
> On 2022-07-12 13:22:34 [+0200], David Oberhollenzer wrote:
>> This is a backport of Sebastian's MEMCG changes to v5.15. With these
>> patches applied, it is possible to use memory cgroups together
>> with PREEMPT_RT on v5.15, just like on v5.17.
> 
> This isn't the series that was merged upstream:
> | 0001-mm-memcg-Revert-mm-memcg-optimize-user-context-objec.patch
> | 0002-mm-memcg-Disable-threshold-event-handlers-on-PREEMPT.patch
> | 0003-mm-memcg-Protect-per-CPU-counter-by-disabling-preemp.patch
> | 0004-mm-memcg-Opencode-the-inner-part-of-obj_cgroup_uncha.patch
> | 0005-mm-memcg-Protect-memcg_stock-with-a-local_lock_t.patch
> | 0006-mm-memcg-Disable-migration-instead-of-preemption-in-.patch
> | 0007-mm-memcg-Add-missing-counter-index-which-are-not-upd.patch
> | 0008-mm-memcg-Add-a-comment-regarding-the-release-obj.patch
> | mm-memcg-Only-perform-the-debug-checks-on-PREEMPT_RT.patch
> 
> any reason why not backport those?
> 

this patch set is based on the one Richard submitted in late
June, but was asked to use the changes from v5.17 instead
of v5.16. I was under the impression that this meant to use
the state of the code in v5.17 instead, as some of the back
ported code was refactored a bit further upstream.

I tried to stick to Richards patch set, picking the equivalent
changes in mm from the git history, leading up to the v5.17.1-rt17
tag in linux-rt-devel. So, except for the changes to make it work
on v5.15.49-rt47 in linux-stable-rt, those patches should represent
what ended up in 5.17.1-rt17, right?

Greetings,

David
Sebastian Andrzej Siewior Aug. 3, 2022, 9:37 a.m. UTC | #9
On 2022-08-03 11:17:22 [+0200], David Oberhollenzer wrote:
> Hi Sebastian,
Hi David,

> this patch set is based on the one Richard submitted in late
> June, but was asked to use the changes from v5.17 instead
> of v5.16. I was under the impression that this meant to use
> the state of the code in v5.17 instead, as some of the back
> ported code was refactored a bit further upstream.

You refer to
    https://lore.kernel.org/all/1958751921.205825.1655985764383.JavaMail.zimbra@nod.at/T/#u
 
> I tried to stick to Richards patch set, picking the equivalent
> changes in mm from the git history, leading up to the v5.17.1-rt17
> tag in linux-rt-devel. So, except for the changes to make it work
> on v5.15.49-rt47 in linux-stable-rt, those patches should represent
> what ended up in 5.17.1-rt17, right?

I pointed out the patches from the queue that ended upstream.
After upstream's review a few things changed like the revert of the
user/irq context and so on. For simplicity reasons I would prefer to
stick with one solution and not add the intermediate patches, that I had
in the queue before I was able to settle with upstream on something, to
release that is maintained for a longer period. So any problems that pop
in 5.15 should be same as in later releases.

The patches I mentioned ended up in v5.18 and were part of the latest
v5.17-RT releases including v5.17.1-rt17, yes.

> Greetings,
> 
> David

Sebastian