How to handle linux page cache (tag lookup) returning less pages that what was asked?

102 Views Asked by At

This is from a file system perspective.

The file system page size is 8K (i.e. double the block size, 4k).
So, when I dirty pages and go for a flush, I make sure that the range passed to pvec_lookup_tag() is 8k aligned at all costs. The page cache should give me pages starting at 8k aligned address (i.e. even index)

So, down to the problem.

I have already dirtied the pages and then I ask the page cache for 14 dirty pages in some specified range and mapping.
But, surprisingly it gives me just one page which is odd aligned.
In short, I'm getting just the second 4k page of my originally intended 8k page.
Also, I checked the mapping by taking a crashdump. All the 14 pages I had asked were right there and also marked dirty.

Just retrying the same lookup gives me the correct pages. But I feel there must be a better solution here.
Is there some weird window between marking the pages dirty and trying a tag lookup that is causing this?

(I'm on Linux Kernel v3.10.x)


Okay, Let me rephrase the question in simpler terms.

Is it possible that a tag lookup in linux gives me less pages than I asked for?
If yes, how to handle such cases?

0

There are 0 best solutions below