Hello, I want to work upon implementing of clustered page reading in GNU/Mach, as GSoC project. The goal of this project is not only add ability of reading more than one page when page fault occurs, but also implement appropriate interface for user to give him ability to configure behavior at page faults. Usual way for this in POSIX-compatible operating systems is using of function madvise.
This function allows user advise the kernel about how to handle paging input/output in specified memory range. There are several behaviors, like RANDOM, NORMAL, SEQUENTIAL, WILLNEED and DONTNEED. From the page fault handler's point of view these behaviors differ only in size of memory chunk that will be read ahead. The project I suppose to work on is not new for GSoC. Two years ago a student, whose nick on irc channel is kam, tried to implement readahead, but didn't manage to do that for some reason. I looked through patch he has sent and there he appended function vm_behavior_set for setting behavior of page fault handler. As parameter, this function accepts constant, that specifies behavior in way that is similar to the way is implemented in madvise. But I think, that if difference between behavior lies only in size of chunk to be read it will be more flexible to accept as parameter of vm_behavior_set not constant, that represents behavior, but size of chunk. And madvise implementation in library will convert behavior name to size of chunk (and for sure do other work). This will allow do more work in user space and add to kernel less modifications. Also kam takes into account the direction of reading for sequential behavior, but I doubt if this really needed, because it seems to be unusual way of reading. Additionally madvise doesn't have appropriate parameters which could be used to inform kernel about direction of reading. Am I right or is it better to do like kam was doing? Regards, Maksym Planeta.