Re: classzone-VM + mapped pages out of lru_cache

From: Andrea Arcangeli (andrea@suse.de)
Date: Thu May 04 2000 - 16:40:12 EST


On Thu, 4 May 2000, Andrea Arcangeli wrote:

>I'm fixing it stay tuned...

I fixed it. The still untested fix for the lookup looks like this:

        head = &mapping->pages;
 repeat:
        spin_lock(&pagecache_lock);
- curr = head->next;
- while (curr != head) {
+ while ((curr = head->next) != head) {
                unsigned long offset;
 
                page = list_entry(curr, struct page, list);

but I also fixed the issues between read(2) and truncate(2) running in
parallel (thanks Manfred for explanation) alongs the lines of pre7-3.

current in-kernel truncate isn't good, it loops here:

                /* partial truncate, clear end of page */
                if (TryLockPage(page)) {
                        spin_unlock(&pagecache_lock);
                        goto repeat;
                }

and in non partial truncate path it forgets to acquire the page count
before relasing the spinlock (that would ensure we won't wait on the wrong
page and that's much saner).

Also the repeat should be after setting head (head address doesn't change,
it's only the contents of head that changes instead).

repeat:
        head = &mapping->pages;
        spin_lock(&pagecache_lock);

Andrea

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:16 EST