Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3038973imj; Mon, 11 Feb 2019 12:45:18 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib6ABiBOKwzxJtNuvvkzm932JeBR5mV1QIfp3EPZwiw7EbX8FALtefiWoTz8SrUZKT86rUo X-Received: by 2002:a17:902:bd82:: with SMTP id q2mr155449pls.156.1549917918293; Mon, 11 Feb 2019 12:45:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917918; cv=none; d=google.com; s=arc-20160816; b=fhTLsN5YO/jlF/Ok1jnglWrAmBJYNtmEdzNPqjcewW60Dkf64sPAaMcCZpqOpDFhn3 YZX++O94DGNVt2pYm/tvV5Dx7ORZBPwcVvuWGeOhuuKWfHfPJEs77dB4gSOtTf0RfKKz qMckpWwTFYXh5oHH81vDxnGA8JvWb66sGjW8rmmuwmvm7EH2FttUk/TC80LPMyHzzx/9 rcDAAoKkpmhznQmuGGKd3C91C9gwWDJj/DkLPcVum1YfKUbRjC+1zeqgRrdOtQ6yuNjs FruH9kHRDzFq/+Nb04IkPGhpHYGqcH/KlERyYmQTk2ckz/nCRcaLBXOX0qimOpa4/UJL puqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=bJ92XFGdXoI66IabC1B27UhUDJuwdv8r8xTw01NIqEw=; b=qnd6SwTf09sDWukb47SSwljMRjSEQnHInvvx9TlJG7GGOA1YLTG9Ds3GUnjMjs/Fkm vzJ0/8drWF4YjaPqCZ4ThbqwtmjWuBL687wvuUBnGf5eDhfxNXUFhdaoza+7b0qvxYzi 4bI4uJhzGjPHO96znfbHucDJG+g2OntwQiu2U80eoWfY9ylblozEC2gA9Sdv7diZfBF3 PQ6UXNiZ1TWJWTNNo/2V99Fdb2r1DkQXhsUz0EVHIuJFuN2gOd5//xUm9e+PPa3b0Im3 mQ4PKVqDGPBa665G5bFLntha/i6CE5NCRrwfPo3NKcjdQdu51RJuKr1+fq0VhEW5Y95f q+Fw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si11329457plv.258.2019.02.11.12.45.02; Mon, 11 Feb 2019 12:45:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732320AbfBKUCI (ORCPT + 99 others); Mon, 11 Feb 2019 15:02:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52280 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbfBKUCI (ORCPT ); Mon, 11 Feb 2019 15:02:08 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF3B358E22; Mon, 11 Feb 2019 20:02:07 +0000 (UTC) Received: from sky.random (ovpn-120-178.rdu2.redhat.com [10.10.120.178]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 714BD5C21A; Mon, 11 Feb 2019 20:02:01 +0000 (UTC) Date: Mon, 11 Feb 2019 15:02:00 -0500 From: Andrea Arcangeli To: Jerome Glisse Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Peter Xu , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andrew Morton , Matthew Wilcox , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Michal Hocko , kvm@vger.kernel.org Subject: Re: [RFC PATCH 0/4] Restore change_pte optimization to its former glory Message-ID: <20190211200200.GA30128@redhat.com> References: <20190131183706.20980-1-jglisse@redhat.com> <20190201235738.GA12463@redhat.com> <20190211190931.GA3908@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190211190931.GA3908@redhat.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 11 Feb 2019 20:02:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 11, 2019 at 02:09:31PM -0500, Jerome Glisse wrote: > Yeah, between do you have any good workload for me to test this ? I > was thinking of running few same VM and having KSM work on them. Is > there some way to trigger KVM to fork ? As the other case is breaking > COW after fork. KVM can fork on guest pci-hotplug events or network init to run host scripts and re-init the signals before doing the exec, but it won't move the needle because all guest memory registered in the MMU notifier is set as MADV_DONTFORK... so fork() is a noop unless qemu is also modified not to call MADV_DONTFORK. Calling if (!fork()) exit(0) from a timer at regular intervals during qemu runtime after turning off MADV_DONTFORK in qemu would allow to exercise fork against the KVM MMU Notifier methods. The optimized change_pte code in copy-on-write code is the same post-fork or post-KSM merge and fork() itself doesn't use change_pte while KSM does, so with regard to change_pte it should already provide a good test coverage to test with only KSM without fork(). It'll cover the read-write -> readonly transition with same PFN (write_protect_page), the read-only to read-only changing PFN (replace_page) as well as the readonly -> read-write transition changing PFN (wp_page_copy) all three optimized with change_pte. Fork would not leverage change_pte for the first two cases.