On Wed, 2024-02-14 at 12:30 -0800, Suren Baghdasaryan wrote: > On Wed, Feb 14, 2024 at 12:17 PM Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote: > > > > > > > Performance overhead: > > > > > To evaluate performance we implemented an in-kernel test executing > > > > > multiple get_free_page/free_page and kmalloc/kfree calls with allocation > > > > > sizes growing from 8 to 240 bytes with CPU frequency set to max and CPU > > > > > affinity set to a specific CPU to minimize the noise. Below are results > > > > > from running the test on Ubuntu 22.04.2 LTS with 6.8.0-rc1 kernel on > > > > > 56 core Intel Xeon: > > > > > > > > > > kmalloc pgalloc > > > > > (1 baseline) 6.764s 16.902s > > > > > (2 default disabled) 6.793s (+0.43%) 17.007s (+0.62%) > > > > > (3 default enabled) 7.197s (+6.40%) 23.666s (+40.02%) > > > > > (4 runtime enabled) 7.405s (+9.48%) 23.901s (+41.41%) > > > > > (5 memcg) 13.388s (+97.94%) 48.460s (+186.71%) > > > > > > (6 default disabled+memcg) 13.332s (+97.10%) 48.105s (+184.61%) > > > (7 default enabled+memcg) 13.446s (+98.78%) 54.963s (+225.18%) > > > > I think these numbers are very interesting for folks that already use > > memcg. Specifically, the difference between 6 & 7, which seems to be > > ~0.85% and ~14.25%. IIUC, this means that the extra overhead is > > relatively much lower if someone is already using memcgs. > > Well, yes, percentage-wise it's much lower. If you look at the > absolute difference between 6 & 7 vs 2 & 3, it's quite close. > > > > > > > > > (6) shows a bit better performance than (5) but it's probably noise. I > > > would expect them to be roughly the same. Hope this helps. > > > > > > > Thanks for the data. It does show that turning on memcg does not cost extra overhead percentage wise. Tim