Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3406415ybc; Mon, 18 Nov 2019 14:58:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzRZW1TiiSf8iYu3JXQfdwwKJ/Vpj3RLVZSAHXSuRylsRe8iJUHekrKJ9MzSPsx807sSSYi X-Received: by 2002:a5d:4585:: with SMTP id p5mr15522085wrq.134.1574117908848; Mon, 18 Nov 2019 14:58:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574117908; cv=none; d=google.com; s=arc-20160816; b=ib4aWFWoqwjRR1KNe2aPpl4NsK4QTt7IlvvjpnIzng9hBdFHLlMRNwGHCUeC/ioP7Z xIUiEeT7ZYpQjhGGVImqNFfea0NsM6oUxitoHCUF5Hg57wwblSOzutLx7VSo4Pj5AN/v 486eBejwlDL+lsy+h28i62t9vf1XwxhsSAT84CqcIPMQy3jt9X4rEoE9UI0BAeZdNu6Z rbhuEnEDZNXsCkSb3P+WpIFb36NvZDq7vOMHACX0YSNmEvYcjMpo5ZavQVDG2IZSjkrl cazEMXPrvJyAseUSNtR9akc97KUCYEtTtzLF1zImch0lyrQt6H2zJmvIrLWDgny7Y4W/ 78bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:in-reply-to:mime-version:references :message-id:subject:cc:to:from:date:dkim-signature; bh=SIFN0DSE2a6uRlEGbcGYw3B4WnteeMfXDq8qzdRcgWA=; b=LMDroCDXl/gwCsNaEKet+g810J9EEnCJEeXgpEFKEkn3L+sk/2tuvuHeW4i0Gn43os Je3gRIrCSNAIHX1JORED3humOp61UiiGYAK1t6wpSUbTDMwKyW5hndrYXExhheysNa38 ZKXAD38rJmBEElEH0+ut+CJX/oAKttJhZrz0LgCAtLBaed9gOFPKLWOQ7apSqyUYAIlf k9L+s9rZ+LwwB/mRTCiE2ETBiD3mLltY2k/38GvS1JlUA/4g8sZhsWhLM9ERI0zZ5joF UbRFIWqt5l8zA2MSsCO5k87G0wqmhdRavvAWj9/SrmqcPnUB1VWPzxma9mrODwf5XTrZ 8waw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EF0IIECD; 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=pass (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 i3si11082346edx.271.2019.11.18.14.58.05; Mon, 18 Nov 2019 14:58:28 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EF0IIECD; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727059AbfKRW4b (ORCPT + 99 others); Mon, 18 Nov 2019 17:56:31 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:26318 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726705AbfKRW4b (ORCPT ); Mon, 18 Nov 2019 17:56:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574117789; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SIFN0DSE2a6uRlEGbcGYw3B4WnteeMfXDq8qzdRcgWA=; b=EF0IIECDy40qgcVkE1CDldjz/WAY0YJECsn5fRj+wEbmPFmoOSem8IlYKQuq6B9/dxbSyT dRqQ2uUKLgRuNTsIbT4DdXU6Yg1uBeep/T5rGx3LoaTmNZo0DjFj8BpNl6dPtwDEaiu7bw 6igmzGDpAa2nEF+xK9MEYrhexk2WTE0= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-194-rVd5YYcON2aYErV2zGQKZQ-1; Mon, 18 Nov 2019 17:56:28 -0500 Received: by mail-wr1-f72.google.com with SMTP id w4so17002938wro.10 for ; Mon, 18 Nov 2019 14:56:28 -0800 (PST) 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=HioSahbeNRN41x4RVyYU/tP+TcFzJdT9IZVxNGFaNo8=; b=rU0+XHMADQMffeQsh1vqXAySYw9m5NaOAjaGAl86av1SYlZVcrNRapG4/WB3LlMjVe NlzLlldVMn+WCTyjLkbfvTU4m57ijnlfVEk0q3b88X6nqMTrUlmYy2sGnMVlcJPK/RaN mplD/WOqKCXX5/2DaKNaPN4OMI9hif4oclQ1j9tB1RyhLhJT07iSEsie689r+q1tjWcZ ggrNhK6vOPAPvwNVFZw1nL9LZUnIBxFZoTKdFTuhxoQ8aFwpeEjhqb3MTvXbgVyt+kDS UfWxHVjfaDImPk8CiYyVIQHzCsldjKeXCXrMLJvXP+XahS3Gk3HOwCCW8CQ4OkqTjCXP 5ZPw== X-Gm-Message-State: APjAAAWnMEVTDF3M1WwYP/esfubdgw/iQmxVAhFRuCPn+lbAKAplIX4u /7Vv9Bzbu7J9Q5H7rIO9Fsr50kbrVL1TFsT/9lj6UpDkOx4EDZ6HaP7W0PhgeSgExI740rRnbk7 WSn9xit6hb102USWZUtRc82eH X-Received: by 2002:a1c:6a09:: with SMTP id f9mr1971321wmc.15.1574117787432; Mon, 18 Nov 2019 14:56:27 -0800 (PST) X-Received: by 2002:a1c:6a09:: with SMTP id f9mr1971306wmc.15.1574117787217; Mon, 18 Nov 2019 14:56:27 -0800 (PST) Received: from redhat.com (bzq-79-176-6-42.red.bezeqint.net. [79.176.6.42]) by smtp.gmail.com with ESMTPSA id 13sm953862wmk.1.2019.11.18.14.56.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2019 14:56:26 -0800 (PST) Date: Mon, 18 Nov 2019 17:56:24 -0500 From: "Michael S. Tsirkin" To: Khazhismel Kumykov Cc: jasowang@redhat.com, wei.w.wang@intel.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH 2/2] virtio_balloon: fix shrinker_scan return units Message-ID: <20191118175339-mutt-send-email-mst@kernel.org> References: <20191118213811.22017-1-khazhy@google.com> <20191118213811.22017-2-khazhy@google.com> MIME-Version: 1.0 In-Reply-To: <20191118213811.22017-2-khazhy@google.com> X-MC-Unique: rVd5YYcON2aYErV2zGQKZQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 18, 2019 at 01:38:11PM -0800, Khazhismel Kumykov wrote: > We were returning number of virtio balloon pages, which may not be the > same as number of system pages >=20 > Fixes: 86a559787e6f ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT") > Cc: Wei Wang > Signed-off-by: Khazhismel Kumykov > --- > drivers/virtio/virtio_balloon.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_ball= oon.c > index 7cf9540a40b8..7951ece3fe24 100644 > --- a/drivers/virtio/virtio_balloon.c > +++ b/drivers/virtio/virtio_balloon.c > @@ -802,11 +802,11 @@ static unsigned long virtio_balloon_shrinker_scan(s= truct shrinker *shrinker, > =09=09pages_freed =3D shrink_free_pages(vb, pages_to_free); > =20 > =09if (pages_freed >=3D pages_to_free) > -=09=09return pages_freed; > +=09=09return pages_freed / VIRTIO_BALLOON_PAGES_PER_PAGE; > I'm no seeing why is this one right. shrink_free_pages gives result in PAGE_SIZE units, right? =20 > =09pages_freed +=3D shrink_balloon_pages(vb, pages_to_free - pages_freed= ); > =20 > -=09return pages_freed; > +=09return pages_freed / VIRTIO_BALLOON_PAGES_PER_PAGE; My head hurts. Isn't this what patch 1 tweaked? > } > =20 > static unsigned long virtio_balloon_shrinker_count(struct shrinker *shri= nker, > --=20 > 2.24.0.432.g9d3f5f5b63-goog