[LTP] [PATCH 1/1] readahead02: Sleep 1.5 msec to fix problem on bare metal

Petr Vorel pvorel@suse.cz
Fri Nov 21 11:45:06 CET 2025


> Hi!
> > This fixes ppc64le bare metal. It looks like kernel needs some time to
> > update counters.

> In this case I think that something is needed for the kernel to actually
> do some readahead. The readahead() syscall is supposed to initiate
> readahead but kernel will need some time for the actual readahead to
> happen. And how much time will depend on the I/O speed and saturation of
> the I/O bus/disk.

> Adding a short sleep is a good start. However I'm afraid that we will
> need a bit more complex solution to this problem. Maybe do a short
> sleep, check the cache size and if it increased more than some
> threshold, sleep again.

> Something as:

> 	int retries = MAX_RETRIES;
> 	unsigned long cached_prev, cached_cur = get_cached_size();

> 	do {
> 		usleep(SHORT_SLEEP);

> 		cached_prev = cached_cur;
> 		cached_cur = get_cached_size();

> 		if (cached_cur < cached_prev)
> 			break;

> 		if (cached_cur-cached_prev < CACHE_INC_THRESHOLD)
> 			break;

> 	} while (retries-- > 0);

Yeah, few loops with shorter usleep() and proactive checking is for sure way
better than single usleep(). Will you please have time to send the above as a
patch? I'll test it for you.

Kind regards,
Petr


More information about the ltp mailing list