Re: sendfile and page usage statistics

[ Available lists | Index of freebsd-current | Month of Oct 2007 | Week of 10 Oct 2007 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Antony Mawer <fbsd-current@mawer.org>
Date
10 Oct 2007 06:45:40
Subject
Re: sendfile and page usage statistics
Message-ID
470C6DD4.1060509@mawer.org

In reply to
Replies

[ Hide this part ]
On 10/10/2007 4:06 PM, Igor Sysoev wrote:
> On Wed, Oct 10, 2007 at 09:57:48AM +0400, Igor Sysoev wrote:
>
>> On Tue, Oct 09, 2007 at 04:50:01PM +0400, Igor Sysoev wrote:
>>
>>> As I understand if sendfile() with hardware TX chsum or TSO are used,
>>> then CPU does not touch file pages at all. So pagedaemon never set
>>> PG_REFERENCED to vnode object pages while scanning them.
>>> Does VM set PG_REFERENCED by another way ? Otherwise, often used files
>>> that accessed by sendfile() only have small chances to be cached by VM.
>> I have looked kern_sendfile() in CURRENT and it seems to me that
>> PG_REFERENCED is never set when sendfile() gets cached vm_page.
>> I have looked the code path:
>>
>> vm_page_grab()
>> vm_page_lookup()
>> vm_page_wire()
>> sf_buf_alloc() on i386 and amd64
>>
>> and have not seen PG_REFERENCED.
>
> As I understand the following patch against uipc_syscalls.c
> should fix the bug to some extent:
>
> if (pg->valid && vm_page_is_valid(pg, pgoff, xfsize))
> + vm_page_flag_set(pg, PG_REFERENCED);
> VM_OBJECT_UNLOCK(obj);
> else if (m != NULL)

You are missing opening/closing braces on your if() statement with this
change...

--Antony


Elapsed time: 0.114 seconds