From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758261Ab1FVX7X (ORCPT ); Wed, 22 Jun 2011 19:59:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6950 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757685Ab1FVX7V (ORCPT ); Wed, 22 Jun 2011 19:59:21 -0400 Date: Thu, 23 Jun 2011 01:59:06 +0200 From: Andrea Arcangeli To: Nai Xia Cc: Rik van Riel , Izik Eidus , Avi Kivity , Andrew Morton , Hugh Dickins , Chris Wright , linux-mm , Johannes Weiner , linux-kernel , kvm Subject: Re: [PATCH] mmu_notifier, kvm: Introduce dirty bit tracking in spte and mmu notifier to help KSM dirty bit tracking Message-ID: <20110622235906.GC20843@redhat.com> References: <201106212055.25400.nai.xia@gmail.com> <201106212132.39311.nai.xia@gmail.com> <4E01C752.10405@redhat.com> <4E01CC77.10607@ravellosystems.com> <4E01CDAD.3070202@redhat.com> <4E01CFD2.6000404@ravellosystems.com> <4E020CBC.7070604@redhat.com> <20110622165529.GY20843@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 23, 2011 at 07:37:47AM +0800, Nai Xia wrote: > On 2MB pages, I'd like to remind you and Rik that ksmd currently splits > huge pages before their sub pages gets really merged to stable tree. > So when there are many 2MB pages each having a 4kB subpage > changed for all time, this is already a concern for ksmd to judge > if it's worthwhile to split 2MB page and get its sub-pages merged. Hmm not sure to follow. KSM memory density with THP on and off should be identical. The cksum is computed on subpages so the fact the 4k subpage is actually mapped by a hugepmd is invisible to KSM up to the point we get a unstable_tree_search_insert/stable_tree_search lookup succeeding. > I think the policy for ksmd in a system should be "If you cannot do sth good, > at least do nothing evil". So I really don't think we can satisfy _all_ people. > Get a general method and give users one or two knobs to tune it when they > are the corner cases. How do you think of my proposal ? I'm neutral, but if we get two methods for deciding the unstable tree candidates, the default probably should prioritize on maximum merging even if it takes more CPU (if one cares about performance of the core dedicated to ksmd, KSM is likely going to be off or scanning at low rate in the first place). > > On a side note, khugepaged should also be changed to preserve the > > dirty bit if at least one dirty bit of the ptes is dirty (currently > > the hugepmd is always created dirty, it can never happen for an > > hugepmd to be clean today so it wasn't preserved in khugepaged so far). > > > > Thanks for the point that out. This is what I have overlooked! No prob. And its default scan rate is very slow compared to ksmd so it was unlikely to generate too many false positive dirty bits even if you were splitting hugepages through swap. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Arcangeli Subject: Re: [PATCH] mmu_notifier, kvm: Introduce dirty bit tracking in spte and mmu notifier to help KSM dirty bit tracking Date: Thu, 23 Jun 2011 01:59:06 +0200 Message-ID: <20110622235906.GC20843@redhat.com> References: <201106212055.25400.nai.xia@gmail.com> <201106212132.39311.nai.xia@gmail.com> <4E01C752.10405@redhat.com> <4E01CC77.10607@ravellosystems.com> <4E01CDAD.3070202@redhat.com> <4E01CFD2.6000404@ravellosystems.com> <4E020CBC.7070604@redhat.com> <20110622165529.GY20843@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Rik van Riel , Izik Eidus , Avi Kivity , Andrew Morton , Hugh Dickins , Chris Wright , linux-mm , Johannes Weiner , linux-kernel , kvm To: Nai Xia Return-path: Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-Id: kvm.vger.kernel.org On Thu, Jun 23, 2011 at 07:37:47AM +0800, Nai Xia wrote: > On 2MB pages, I'd like to remind you and Rik that ksmd currently splits > huge pages before their sub pages gets really merged to stable tree. > So when there are many 2MB pages each having a 4kB subpage > changed for all time, this is already a concern for ksmd to judge > if it's worthwhile to split 2MB page and get its sub-pages merged. Hmm not sure to follow. KSM memory density with THP on and off should be identical. The cksum is computed on subpages so the fact the 4k subpage is actually mapped by a hugepmd is invisible to KSM up to the point we get a unstable_tree_search_insert/stable_tree_search lookup succeeding. > I think the policy for ksmd in a system should be "If you cannot do sth good, > at least do nothing evil". So I really don't think we can satisfy _all_ people. > Get a general method and give users one or two knobs to tune it when they > are the corner cases. How do you think of my proposal ? I'm neutral, but if we get two methods for deciding the unstable tree candidates, the default probably should prioritize on maximum merging even if it takes more CPU (if one cares about performance of the core dedicated to ksmd, KSM is likely going to be off or scanning at low rate in the first place). > > On a side note, khugepaged should also be changed to preserve the > > dirty bit if at least one dirty bit of the ptes is dirty (currently > > the hugepmd is always created dirty, it can never happen for an > > hugepmd to be clean today so it wasn't preserved in khugepaged so far). > > > > Thanks for the point that out. This is what I have overlooked! No prob. And its default scan rate is very slow compared to ksmd so it was unlikely to generate too many false positive dirty bits even if you were splitting hugepages through swap. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org