Re: [PATCH 0/4] ksm - dynamic page sharing driver for linux v2

From: Ryota OZAKI
Date: Thu Nov 20 2008 - 04:45:05 EST


2008/11/20 Izik Eidus <ieidus@xxxxxxxxxx>:
> ××××× Izik Eidus:
>>
>> ××××× Ryota OZAKI:
>>>
>>> Hi Izik,
>>>
>>> I've tried your patch set, but ksm doesn't work in my machine.
>>>
>>> I compiled linux patched with the four patches and configured with KSM
>>> and KVM enabled. After boot with the linux, I run two VMs running linux
>>> using QEMU with a patch in your mail and started KSM scanner with your
>>> script, then the host linux caused panic with the following oops.
>>>
>>
>> Yes you are right, we are missing pte_unmap(pte); in get_pte()!
>> that will effect just 32bits with highmem so this why you see it
>> thanks for the reporting, i will fix it for v3
>>
>> below patch should fix it (i cant test it now, will test it for v3)
>>
>> can you report if it fix your problem? thanks
>>
> Thinking about what i just did, it is wrong,
> this patch is the right one (still wasnt tested), but if you are going to
> apply something then use this one.

Great! Applied the 2nd patch, ksm works with both HIGHMEM enabled and disabled.

Thanks for your quick response,
ozaki-r

>
> thanks
>
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 707be52..c842c29 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -569,14 +569,16 @@ out:
> static int is_present_pte(struct mm_struct *mm, unsigned long addr)
> {
> pte_t *ptep;
> + int r;
>
> ptep = get_pte(mm, addr);
> if (!ptep)
> return 0;
>
> - if (pte_present(*ptep))
> - return 1;
> - return 0;
> + r = pte_present(*ptep);
> + pte_unmap(ptep);
> +
> + return r;
> }
>
> #define PAGEHASH_LEN 128
> @@ -669,6 +671,7 @@ static int try_to_merge_one_page(struct mm_struct *mm,
> if (!orig_ptep)
> goto out_unlock;
> orig_pte = *orig_ptep;
> + pte_unmap(orig_ptep);
> if (!pte_present(orig_pte))
> goto out_unlock;
> if (page_to_pfn(oldpage) != pte_pfn(orig_pte))
>
>
èº{.nÇ+‰·Ÿ®‰­†+%ŠËlzwm…ébëæìr¸›zX§»®w¥Š{ayºÊÚë,j­¢f£¢·hš‹àz¹®w¥¢¸ ¢·¦j:+v‰¨ŠwèjØm¶Ÿÿ¾«‘êçzZ+ƒùšŽŠÝj"ú!¶iO•æ¬z·švØ^¶m§ÿðà nÆàþY&—