Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C0B7C48BCF for ; Wed, 9 Jun 2021 18:58:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 205D661364 for ; Wed, 9 Jun 2021 18:58:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 205D661364 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lr3Ot-0005bp-U0 for qemu-devel@archiver.kernel.org; Wed, 09 Jun 2021 14:58:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lr3O1-0004i5-RY for qemu-devel@nongnu.org; Wed, 09 Jun 2021 14:57:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38263) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lr3Nz-0008UH-Eh for qemu-devel@nongnu.org; Wed, 09 Jun 2021 14:57:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623265026; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PFI+n5xs/1S+MSJ64VLiheX3EV/4XlIQrzTlr3+TnYs=; b=JoSrxI+TUOYSnrhg9sBe4DhSk05HfSdO+3fgIQkXUM9gzUKK2cHM668f7Iu6IluWxShP79 /b6BdIw31rP8aO5zGDPfr/u8/y3XnKhN39k8gmiiAO+YWxExLtO2lj+Rq0ah5tDEOdQeT+ IbKdYDkRtU5pKlLTLd79tRZC/u4FX64= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-1qVh20SgPPyLShuhseWXZA-1; Wed, 09 Jun 2021 14:57:05 -0400 X-MC-Unique: 1qVh20SgPPyLShuhseWXZA-1 Received: by mail-qk1-f197.google.com with SMTP id k15-20020a05620a138fb02903aadd467ff1so5348228qki.7 for ; Wed, 09 Jun 2021 11:57:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PFI+n5xs/1S+MSJ64VLiheX3EV/4XlIQrzTlr3+TnYs=; b=oFxCyWORBVDXGdA7i8e5W3XaecC6T4tZxqWwwFCaiwlrag/kkooG1izH8e6iu17QGp 3F6y7+NLfVtmPsroILxxlFnsR0fObGY3tjeqAin1ltdc5xHfv1eraFF6llBFn4RHKH+a frxtDj/NSbTiGVo1H1Vo1G19bKppSbXnh+KIOQQ67U3Q1Dyu7/ZBwzwnHnIGj+coeLoX 4qSxTydtSI0AQC3UEE0WuhT0V9fFQI1Ds+cqFd/Rk1mvF1LN8JJsKaXNE4+9xAXPjSGM AM5Y4NCqA32zZ0mYOz85ru3zTD4Kzx9lZsdH+FbHsMoJjy4tb9PYsAQDycYAfx0RPUDG CO2A== X-Gm-Message-State: AOAM530uh15b6P5L8sqvc+TS2XStMvOxmq3Rhdw0kIBILJ0YiTaJfEzw 6ae8Hm103ZaXi6m2678dlBpboJO6vNYB6c3y1/p5DoXQTHCf36FOTuXiTYFj+d+DeRlttYlrQRq aSPvyp7IbhWAFbAQ= X-Received: by 2002:a05:622a:1c1:: with SMTP id t1mr1047726qtw.27.1623265025132; Wed, 09 Jun 2021 11:57:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUTroX3TBdiRCR4gjbvslaMF13ih0mEaQ2fq8zYHQwT2aSqPQFz6cW41ct11PLSvHXb0i0VQ== X-Received: by 2002:a05:622a:1c1:: with SMTP id t1mr1047690qtw.27.1623265024718; Wed, 09 Jun 2021 11:57:04 -0700 (PDT) Received: from t490s (bras-base-toroon474qw-grc-88-174-93-75-200.dsl.bell.ca. [174.93.75.200]) by smtp.gmail.com with ESMTPSA id z3sm637795qkj.40.2021.06.09.11.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 11:57:04 -0700 (PDT) Date: Wed, 9 Jun 2021 14:57:03 -0400 From: Peter Xu To: "Dr. David Alan Gilbert" Subject: Re: [PATCH] hmp: Add "calc_dirty_rate" and "info dirty_rate" cmds Message-ID: References: <20210601005708.189888-1-peterx@redhat.com> MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chuan Zheng , Leonardo Bras Soares Passos , huangy81@chinatelecom.cn, qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Tue, Jun 08, 2021 at 08:36:23PM +0100, Dr. David Alan Gilbert wrote: > * Peter Xu (peterx@redhat.com) wrote: > > On Tue, Jun 08, 2021 at 07:49:56PM +0100, Dr. David Alan Gilbert wrote: > > > * Peter Xu (peterx@redhat.com) wrote: > > > > These two commands are missing when adding the QMP sister commands. Add them, > > > > so developers can play with them easier. > > > > > > > > Cc: Dr. David Alan Gilbert > > > > Cc: Juan Quintela > > > > Cc: Leonardo Bras Soares Passos > > > > Cc: Chuan Zheng > > > > Cc: huangy81@chinatelecom.cn > > > > Signed-off-by: Peter Xu > > > > > > Reviewed-by: Dr. David Alan Gilbert > > > > > > > --- > > > > PS: I really doubt whether this is working as expected... I ran one 200MB/s > > > > workload inside, what I measured is 20MB/s with current algorithm... Sampling > > > > 512 pages out of 1G mem is not wise enough I guess, especially that assumes > > > > dirty workload is spread across the memories while it's normally not the case.. > > > > > > What size of address space did you dirty - was it 20MB? > > > > IIRC it was either 200M or 500M, based on a 1G small VM. > > What was your sample time ? 10 seconds; I used the same sample time for below runs: https://lore.kernel.org/qemu-devel/YMEFqfYZVhsinNN+@t490s/ A large sample time does make dirty rate less indeed, as the same dirty page could be written again as 1 single page dirtyed in the host (while it's counted twice in the guest dirty workload). This effect should happen too if we further extend calc_dirty_rate with KVM_GET_DIRTY_LOG in the future as the 3rd method besides dirty ring. From that pov, dirty ring is easier to be more "accurate" (I don't know whether it's suitable to say it's accurate; it's just easier to trap cases like writting to same page multiple times within a period), as the ring size is normally very limited (e.g. 4096 pages per vcpu), so even the guest workload writes the same page twice, as long as there's a ring collect between the two writes, they'll be counted twice too (each collect will reprotect the pages). -- Peter Xu