Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp121268lqs; Thu, 13 Jun 2024 05:54:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVihqpVAitNlHkQu2EKPY/FlW7Trwhc2Z4EShJ+a/5e4jPKrS7f3fAp3zvOWYRDQOvgEebJmP/VVUfAellLM7g3oMkBMKtnrXVhS34osw== X-Google-Smtp-Source: AGHT+IHQcFWgLfEh+xj7ly3KenOPO4mq/J4y6H+SeMyMzh8Kp98PDq5WEbzmGh0ODh/FtCrufCeH X-Received: by 2002:a05:620a:2942:b0:795:59dc:232d with SMTP id af79cd13be357-797f6037dd1mr559070385a.37.1718283262145; Thu, 13 Jun 2024 05:54:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718283262; cv=pass; d=google.com; s=arc-20160816; b=cb/+yiODqM6Fcl1Fo96e6eE2fBFEchBcInhWrBk4Usk78OauOGZuVTR9GUP2MDFqTf ImG4Sgv1BNZTWANkOVWDOvIS/Jk2CjB/kwSJoTSF2jwVamusxWF7CgFHJ6ZaGMrlHWml MwYXfveERx4Cw7tmVPWQHBvuf0gGEFP9zeIoKziTY3MbudWykPA3sMYgAvZrFlzGng0N pYig5OckhOdrYF5Au7gl1x37fIjA3p5ofVLilb9ESRZMZwU1K3YQyeaqIvBY8p/UQWHR SBUQolhNmjxP1I4Jaz+O24jjts/0bexHFn/7ad4Yo0yTdqQ6H7eD6//nI9R7JabMeI0o QC/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=4Oi1mfENwyg6rhcUjkzr0TzU18hb1XoOjtFqXcm745Y=; fh=f7vpHwWVnc1Gm69Jh4Dv0SPVMxn3OzCXH/wd4ss2rUQ=; b=xvhwxcv2O5BKsnSWpnEFUZxrcXvIKwgs7PHcs/QriG8Lihlctp4Ev4auOha9xm0IWN Adc9dwCa3jzBBwczvSc3Si5dj017sw8MJRCgb9RXOSIA7XOkejPJBn7E8iY8T7HjUBTT ww9gHmtP0CuwHvnUJk2t1aWLoEfLSRqeXAwlUwYFS2uAHWHZqR+0ybauZmXb2J+TUG3s 2HyJJfgzn1rM0sPgSpbK0vMMv0di0tvK7gD11qMHyIxyLMOpRcS0vGXACZ0YuHsDyw4E /Y/qfsD8KtHtjqHU6ErCdOq1ryX93VsnnWhnQxNff+W3PxOQD49BxL4mPNUaUCtBHh0q 04lg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-213239-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213239-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-798ac08eef2si135249485a.742.2024.06.13.05.54.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 05:54:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213239-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-213239-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213239-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D594C1C212AE for ; Thu, 13 Jun 2024 12:54:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64C591411C5; Thu, 13 Jun 2024 12:54:14 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05E321DDDB; Thu, 13 Jun 2024 12:54:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718283253; cv=none; b=pDod5xyFswlSu+bg4QbZjJBWk4PSuZ3M25A6wMoNzRRCqrOYUB2pAtLPluvx4vp49SyfYiBJaIz0EhDyGsESW+MYCiiuzCTu1QodI/4CRYIRpS+ZGbc/2QoXLQtPN7I7YbPCBriabeOvYDlrcKK9s8DzD/Sxqh3L865uTrCwM/g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718283253; c=relaxed/simple; bh=J18AC9C3HBhsFS6ts2hpGgSXZdois+TGb2T/FrA5fpU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=IOhzD5+abw64kbjtrQW+tT1dOKMyDCRJ9q14hXS3kLPuI+6Uhpoji3f3/DlR2X/Kr0JWfgalDYqt31lgLk03vGEPSl5VcoT6Noj0dMGj7yvIBW8ybvMJafpFNYiefEkBHolM2tRTHxna3Q4tWVuWn9iBStXdaqqHuexdxqB0XI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8Cx_erw62pmyYMGAA--.26243S3; Thu, 13 Jun 2024 20:54:08 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxDMfv62pm+70eAA--.9804S2; Thu, 13 Jun 2024 20:54:07 +0800 (CST) From: Bibo Mao To: Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] KVM: Remove duplicated zero clear with dirty_bitmap buffer Date: Thu, 13 Jun 2024 20:54:07 +0800 Message-Id: <20240613125407.1126587-1-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:AQAAf8AxDMfv62pm+70eAA--.9804S2 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Since dirty_bitmap pointer is allocated with function __vcalloc(), there is __GFP_ZERO flag set in the implementation about this function __vcalloc_noprof(). It is not necessary to clear dirty_bitmap buffer with zero again. Signed-off-by: Bibo Mao --- virt/kvm/kvm_main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 14841acb8b95..c7d4a041dcfa 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1669,9 +1669,6 @@ static int kvm_prepare_memory_region(struct kvm *kvm, r = kvm_alloc_dirty_bitmap(new); if (r) return r; - - if (kvm_dirty_log_manual_protect_and_init_set(kvm)) - bitmap_set(new->dirty_bitmap, 0, new->npages); } } base-commit: 83a7eefedc9b56fe7bfeff13b6c7356688ffa670 -- 2.39.3