Re: [PATCH 6/9] readahead: clean up and simplify the code for filemap page fault readahead
From: KOSAKI Motohiro
Date: Sat Apr 11 2009 - 10:08:25 EST
2009/4/11 Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>:
> On Fri, 10 Apr 2009 14:10:03 +0800
> Wu Fengguang <fengguang.wu@xxxxxxxxx> wrote:
>
>> @@ -1553,18 +1581,18 @@ retry_find:
>> if (unlikely(!PageUptodate(page)))
>> goto page_not_uptodate;
>>
>> - /* Must recheck i_size under page lock */
>> + /*
>> + * Found the page and have a reference on it.
>> + * We must recheck i_size under page lock.
>> + */
>> size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
>> - if (unlikely(vmf->pgoff >= size)) {
>> + if (unlikely(offset >= size)) {
>> unlock_page(page);
>> page_cache_release(page);
>> return VM_FAULT_SIGBUS;
>> }
>
> This hunk broke
> mm-update_page_reclaim_stat-is-called-from-page-fault-path.patch.
>
>
> I fixed it thusly:
>
> /*
> * Found the page and have a reference on it.
> * We must recheck i_size under page lock.
> */
> size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
> if (unlikely(offset >= size)) {
> unlock_page(page);
> page_cache_release(page);
> return VM_FAULT_SIGBUS;
> }
> + update_page_reclaim_stat(page);
> ra->prev_pos = (loff_t)offset << PAGE_CACHE_SHIFT;
> vmf->page = page;
> return ret | VM_FAULT_LOCKED;
>
> which seems logical to me.
>
> Although now I look at it, it seems that
> mm-update_page_reclaim_stat-is-called-from-page-fault-path.patch should
> go into 2.6.30?
I haven't see this patch detail and I don't think
mm-update_page_reclaim_stat-is-called-from-page-fault-path.patch
should go into 2.6.30, but I have one question.
> Ah. But I have a note here that I didn't like it, because it adds lots
> of new spinlocking to fastpaths. So I'll leave things as they stand
> until we have had a little talk about that.
add?
old code: grab zone->lru_lock via mark_page_accessed()
new code: grab zone->lru_lock via update_reclaim_stat()
one remove, one add.
But I agree its lock can be removed maybe..
I'm sorry my late work.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/