[LTP] [PATCH v3] overcommit_memory: Fix unstable subtest
Cyril Hrubis
chrubis@suse.cz
Thu Dec 3 16:30:30 CET 2020
Hi!
> +static long get_total_batch_size_bytes(void)
> +{
> + struct sysinfo info;
> + long ncpus = tst_ncpus_conf();
> + long pagesize = getpagesize();
> + SAFE_SYSINFO(&info);
> +
> + /* see linux source mm/mm_init.c mm_compute_batch() (This is in pages) */
> + long batch_size = MAX(
> + ncpus * 2,
> + MAX(
> + 32,
> + MIN(
> + INT32_MAX,
> + (long)(info.totalram / pagesize) / ncpus / 256
> + )
> + )
> + );
> +
> + /* there are ncpu separate counters, that can all grow up to
> + * batch_size. So the maximum error for __vm_enough_memory is
> + * batch_size * ncpus. */
> + return batch_size * ncpus * pagesize;
> +}
This version looks better. However two (minor) comments for this
function still apply.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list