On Thu, 2005-10-20 at 13:27 -0400, Jeff Dike wrote: > On Thu, Oct 20, 2005 at 08:11:05AM -0700, Badari Pulavarty wrote: > > Initial plan was to use invalidate_inode_pages2_range(). But it didn't > > really do what we wanted. So we ended up using truncate_inode_pages(). > > If it really works, then I plan to add truncate_inode_pages2_range() > > to which works on a range of pages, instead of the whole file. > > madvise(DONTNEED) followed by madvise(DISCARD) should be able to drop > > all the pages in the given range. > > > > Does this make sense ? Does this seem like right approach ? > > Works for me. I obviously have no idea about the wider vm implications of > this - that would be Hugh's territory :-) Here is the latest version of madvise(DISCARD) I cooked up after talking to Darren. Changes from previous: 1) madvise(DISCARD) - zaps the range and discards the pages. So, no need to call madvise(DONTNEED) before. 2) I added truncate_inode_pages2_range() to just discard only the range of pages - not the whole file. Hugh, when you get a chance could you review this instead ? Thanks, Badari