[LTP] [PATCH v3 5/5] cgroup: Add memcontrol02

Richard Palethorpe rpalethorpe@suse.de
Wed Jan 5 06:12:52 CET 2022


Hello,

Richard Palethorpe <rpalethorpe@suse.de> writes:

> Hello,
>
> Cyril Hrubis <chrubis@suse.cz> writes:
>
>>> + *
>>> + * [Description]
>>> + *
>>> + * Conversion of second kself test in cgroup/test_memcontrol.c.
>>> + *
>>> + * Original description:
>>> + * "This test creates a memory cgroup, allocates some anonymous memory
>>> + * and some pagecache and check memory.current and some memory.stat
>>> + * values."
>>> + *
>>> + * Note that the V1 rss and cache counters were renamed to anon and
>>> + * file in V2. Besides error reporting, this test differs from the
>>> + * kselftest in the following ways:
>>> + *
>>> + * . It supports V1.
>>> + * . It writes instead of reads to fill the page cache. Because no
>>> + *   pages were allocated on tmpfs.
>>
>> Shouldn't we actually run the test both for read/write and skip the read
>> part of tmpfs?
>>
>> Well I guess that the pages are put into the page cache the same way
>> regardless if they came from userspace write or as a request for data to
>> be read from the disk, so probably not I guess.
>
> I reckon there are a lot of ways to fill the page cache from
> userland. mmap and madvise also come to mind. I don't know how many ways
> there are to get/allocate a page from the page cache internally. I guess
> it's possible to circumvent the accountancy.
>
> I think for now just writing is good enough. This doesn't appear to be
> the only test which measures the page cache. So I think we should look
> at what the other tests do first. 
>
>>
>>> + * . It runs on most filesystems available
>>> + * . On EXFAT and extN we change the margine of error between all and file
>>                                            ^
>> 					   margin
>>> + *   memory to 50%. Because these allocate non-page-cache memory during writes.
>>> + */
>>> +#define _GNU_SOURCE
>>> +
>>> +#include <stdlib.h>
>>> +#include <stdio.h>
>>
>> Do we really need stdio here?
>
> Sorry, nope.
>

Actually it is needed otherwise BUFSIZ is undefined...

-- 
Thank you,
Richard.


More information about the ltp mailing list