Re: [PATCH v3] mm: memcg: use rstat for non-hierarchical stats

From: Yosry Ahmed
Date: Thu Aug 03 2023 - 14:53:18 EST


On Thu, Aug 3, 2023 at 7:55 AM Michal Hocko <mhocko@xxxxxxxx> wrote:
>
> On Wed 02-08-23 15:02:55, Yosry Ahmed wrote:
> [...]
> > Let me know if the testing is satisfactory for you. I can send an
> > updated commit log accordingly with a summary of this conversation.
>
> Yes this should be sufficient as it exercises all the CPUs so the
> overhead in flushing should be visible if this was a real deal. I would
> have gone with kernel build test as that has a broader code coverage but
> this artificial test should give some red flags as well. So good enough.
> Amending the changelog with this would be helpful as well so that future
> us and others will know what kind of testing has been done.
>
> Acked-by: Michal Hocko <mhocko@xxxxxxxx>

Thanks! I sent a v4 with your Ack and an amended changelog that
describes the testing done and points to the script attached here.

>
> >
> > > > --
> > > > Michal Hocko
> > > > SUSE Labs
>
> > #!/bin/bash
> >
> > NR_CPUS=$(getconf _NPROCESSORS_ONLN)
> > NR_CGROUPS=$(( NR_CPUS * 2 ))
> > TEST_MB=50
> > TOTAL_MB=$((TEST_MB * NR_CGROUPS))
> > TMPFS=$(mktemp -d)
> > ROOT="/sys/fs/cgroup/"
> > ZRAM_DEV="/mnt/devtmpfs/zram0"
> >
> > cleanup() {
> > umount $TMPFS
> > rm -rf $TMPFS
> > for i in $(seq $NR_CGROUPS); do
> > cgroup="$ROOT/cg$i"
> > rmdir $cgroup
> > done
> > swapoff $ZRAM_DEV
> > echo 1 > "/sys/block/zram0/reset"
> > }
> > trap cleanup INT QUIT EXIT
> >
> > # Setup zram
> > echo $((TOTAL_MB << 20)) > "/sys/block/zram0/disksize"
> > mkswap $ZRAM_DEV
> > swapon $ZRAM_DEV
> > echo "Setup zram done"
> >
> > # Create cgroups, set limits
> > echo "+memory" > "$ROOT/cgroup.subtree_control"
> > for i in $(seq $NR_CGROUPS); do
> > cgroup="$ROOT/cg$i"
> > mkdir $cgroup
> > echo $(( (TEST_MB << 20) / 4)) > "$cgroup/memory.max"
> > done
> > echo "Setup cgroups done"
> >
> > # Start workers to allocate tmpfs memory
> > mount -t tmpfs none $TMPFS
> > for i in $(seq $NR_CGROUPS); do
> > cgroup="$ROOT/cg$i"
> > f="$TMPFS/tmp$i"
> > (echo 0 > "$cgroup/cgroup.procs" &&
> > dd if=/dev/zero of=$f bs=1M count=$TEST_MB status=none &&
> > cat $f > /dev/null)&
> > done
> >
> > # Wait for workers
> > wait
>
>
> --
> Michal Hocko
> SUSE Labs