Skip to contentSkip to conversation

Turn off readahead completely

DISCUSSION [email protected] 2 participants 4 messages Oct 21, 2021 – Oct 25, 2021 VFS

lore
Share & tools
lore
#0 lore raw

Hello everyone,

I need to turn readahead off completely in order to do my experiments. Is there any way to turn it off completely?

Setting /sys/block/<dev>/queue/read_ahead_kb to 0 causes readahead to become 4kb.

Thanks,
Azat

#1 lore raw
Quoted 6 lines · On Thu, Oct 21, 2021 at 01:16:46PM +0000, [email protected] wrote:

Hello everyone,

I need to turn readahead off completely in order to do my experiments. Is there any way to turn it off completely?

Setting /sys/block/<dev>/queue/read_ahead_kb to 0 causes readahead to become 4kb.

That's entirely intentional. What experiment are you actually trying to perform?

#2 lore raw

Thank you for the reply, Matthew.

I'm experimenting with GDAL and, in particular, working on improving the I/O performance of geo-applications. I wanted to get more control from the application over how the kernel handles I/O requests.
But basically all the optimizations are hidden in readahead. Whatever requests are executed are all translated into readahead.

It would be very useful to be able to evaluate the difference with more fine-grained control on the application side.

-----Original Message-----
From: Matthew Wilcox <[email protected]>
Sent: Donnerstag, 21. Oktober 2021 15:28
To: Nurgaliev, Azat <[email protected]>
Cc: [email protected]
Subject: Re: Turn off readahead completely

Quoted 6 lines · On Thu, Oct 21, 2021 at 01:16:46PM +0000, [email protected] wrote:

Hello everyone,

I need to turn readahead off completely in order to do my experiments. Is there any way to turn it off completely?

Setting /sys/block/<dev>/queue/read_ahead_kb to 0 causes readahead to become 4kb.

That's entirely intentional. What experiment are you actually trying to perform?

#3 lore raw
Quoted 7 lines · On Mon, Oct 25, 2021 at 11:55:03AM +0000, [email protected] wrote:

Thank you for the reply, Matthew.

I'm experimenting with GDAL and, in particular, working on improving the I/O performance of geo-applications. I wanted to get more control from the application over how the kernel handles I/O requests.
But basically all the optimizations are hidden in readahead. Whatever requests are executed are all translated into readahead.

It would be very useful to be able to evaluate the difference with more fine-grained control on the application side.

Ah! Then what you've done will be fine for your purpose.

What's going on here is that the kernel tries to read() from part of the file that isn't cached. So it allocates a page of memory and then does a page-sized readahead to that one page. It then waits for the readahead to complete. If it fails (eg EIO), it'll try to read the page using the filesystem's ->readpage operation.

While you see a readahead operation, it's not *really* a readahead operation. It's doing the exact same read that you'd see if there were no readahead operation.

Quoted 16 lines

-----Original Message-----
From: Matthew Wilcox <[email protected]>
Sent: Donnerstag, 21. Oktober 2021 15:28
To: Nurgaliev, Azat <[email protected]>
Cc: [email protected]
Subject: Re: Turn off readahead completely

Quoted 6 lines · On Thu, Oct 21, 2021 at 01:16:46PM +0000, [email protected] wrote:

Hello everyone,

I need to turn readahead off completely in order to do my experiments. Is there any way to turn it off completely?

Setting /sys/block/<dev>/queue/read_ahead_kb to 0 causes readahead to become 4kb.

That's entirely intentional. What experiment are you actually trying to perform?