# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1182914122 -32400 # Node ID 07fce4e87390b29f323504973e7e4e432a9caa00 # Parent 6433fb4f88d6779073bb527e0ea13814206d3259 blktap and gntdev work around for page accounting when auto translated mode. While vm_insert_page() increments file_rss counter unconditionally, we don't want to increment. As work around, decrement the counter after vm_insert_page() call. PATCHNAME: blktap_and_gntdev_page_accouting Signed-off-by: Isaku Yamahata diff -r 6433fb4f88d6 -r 07fce4e87390 drivers/xen/blktap/blktap.c --- a/drivers/xen/blktap/blktap.c Thu Jun 21 22:37:49 2007 +0100 +++ b/drivers/xen/blktap/blktap.c Wed Jun 27 12:15:22 2007 +0900 @@ -1487,6 +1487,15 @@ static void dispatch_rw_block_io(blkif_t up_write(&info->vma->vm_mm->mmap_sem); goto fail_flush; } + /* + * kludge + * vm_insert_page() increments file_rss but + * we don't want to increment so that compensate here. + * The right fix is to update vm_insert_page() so that + * it doesn't increment file_rss, but we don't want to + * touch common code. + */ + dec_mm_counter(info->vma->vm_mm, file_rss); } } if (xen_feature(XENFEAT_auto_translated_physmap)) diff -r 6433fb4f88d6 -r 07fce4e87390 drivers/xen/gntdev/gntdev.c --- a/drivers/xen/gntdev/gntdev.c Thu Jun 21 22:37:49 2007 +0100 +++ b/drivers/xen/gntdev/gntdev.c Wed Jun 27 12:15:22 2007 +0900 @@ -651,6 +651,18 @@ static int gntdev_mmap (struct file *fli /* In this case, we simply insert the page into the VM * area. */ ret = vm_insert_page(vma, user_vaddr, page); + if (!ret) { + /* + * kludge + * vm_insert_page() increments file_rss but + * but we don't want to increment so that + * compensate here. + * The right fix is to update vm_insert_page() + * so that it doesn't increment file_rss, + * but we don't want to touch common code. + */ + dec_mm_counter(vma->vm_mm, file_rss); + } } }