Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp423386ybc; Tue, 19 Nov 2019 03:39:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxTdkSR2kfAPDJVN4WB01+UR/cbBxxuU6NB6autLq260fmEkVg4fMpXXX2m/Jeqenvypaxv X-Received: by 2002:a17:906:f209:: with SMTP id gt9mr34087945ejb.241.1574163551441; Tue, 19 Nov 2019 03:39:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574163551; cv=none; d=google.com; s=arc-20160816; b=jCcpoLT9tdb7jrVF8I/9J+mV1aAqys6Sk0ETeXONtnDLqJImNtdCeai53mAHRIBN7R Wr9E6nh+pEldGDu6JexIj7aK8u9yahzIscmKIXbXGq1Fyyrn4QSR0sUxunc6cEo2eOsd 5S/zQms6IEiMPJcSGE0rze1IDDYJkCxDGDgFea7H/rK3CPa4sFR7X0SFkkqYlvf1caiS pLxIIHGiEhV8p4oBJnv5ZaGXMerxBkAi1cnOqvPGVHOahm/ONT0S/n4c8hVwKkaQHoCQ wd0d9JIVCPhFQeii4+SCSZhR/m4DAyztUuRfVZj7N6f32/FzSxOwMjBSEylRTNb3q5oK BPew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=AqfOLq+nyNFVNclQoFJfwo/6ikJjrtcK+qfEl5kbGec=; b=n5AmG09IGSYFj1xyKRNypXNrYCCar5qeX4iT3LQRD4OZfEClCmoi5nvsKpGqjNAiY+ mns8lLzK+1rFWpW2SMU0jBQucOm2um0x6d7B/odF0NcagDSEIym2NMCnUAKscOytUgQZ cFBybhx+Kouy5KYbh1N2gJggjrMWGmXUTLHhzyXI3nqXXVWaOfKsaYnG5JGs07aGGZ/G qOVz/Z75BGPmRgC8UbHCAU+Y5ySDINRXZiz/etYOLgTMtCMXy+n4UbjsXuoN9N2Hc7DB wMyh0XZ/CWZG2Z8gTvBxe0jEkOyFAoxgM+LLBaCLKkyDqBD+g3DOzG8uySaXKOhfRwGt /Q8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I08wSkKe; 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 t21si15403096edi.123.2019.11.19.03.38.47; Tue, 19 Nov 2019 03:39:11 -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=I08wSkKe; 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 S1727949AbfKSLhc (ORCPT + 99 others); Tue, 19 Nov 2019 06:37:32 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:53607 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727557AbfKSLhc (ORCPT ); Tue, 19 Nov 2019 06:37:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574163451; 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=AqfOLq+nyNFVNclQoFJfwo/6ikJjrtcK+qfEl5kbGec=; b=I08wSkKeGi8rNFLIzaQ/xWejD6Vlzlf9Q4wWeOCV2e1A13TirwfNHPX0YF36zNgssGexZT OSjGKFUoDWUGYF8eIOK+hNPHc1WIAKk53ypgiwY/h1qdH5Kh21QECHVYIC7YIzyb9cF9tV bdb6SArx3Mw64RiS0AvERHYZvqXxb+c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-389-Q9KAV2JMMI6J1UrvZRFU9A-1; Tue, 19 Nov 2019 06:37:27 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CCB74107ACCC; Tue, 19 Nov 2019 11:37:25 +0000 (UTC) Received: from [10.36.117.126] (ovpn-117-126.ams2.redhat.com [10.36.117.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C99B6056B; Tue, 19 Nov 2019 11:37:21 +0000 (UTC) Subject: Re: [PATCH 1/2] virtio_balloon: name cleanups To: "Michael S. Tsirkin" , linux-kernel@vger.kernel.org Cc: Wei Wang , Khazhismel Kumykov , Jason Wang , virtualization@lists.linux-foundation.org References: <20191119102838.39380-1-mst@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Tue, 19 Nov 2019 12:37:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191119102838.39380-1-mst@redhat.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Q9KAV2JMMI6J1UrvZRFU9A-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19.11.19 11:29, Michael S. Tsirkin wrote: > free_page_order is a confusing name. It's not a page order > actually, it's the order of the block of memory we are hinting. > Rename to hint_block_order. Also, rename SIZE to BYTES > to make it clear it's the block size in bytes. >=20 > Signed-off-by: Michael S. Tsirkin > --- > drivers/virtio/virtio_balloon.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) >=20 > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_ball= oon.c > index 65df40f261ab..b6a95cd28d9f 100644 > --- a/drivers/virtio/virtio_balloon.c > +++ b/drivers/virtio/virtio_balloon.c > @@ -32,10 +32,10 @@ > #define VIRTIO_BALLOON_FREE_PAGE_ALLOC_FLAG (__GFP_NORETRY | __GFP_NOWA= RN | \ > =09=09=09=09=09 __GFP_NOMEMALLOC) > /* The order of free page blocks to report to host */ > -#define VIRTIO_BALLOON_FREE_PAGE_ORDER (MAX_ORDER - 1) > +#define VIRTIO_BALLOON_HINT_BLOCK_ORDER (MAX_ORDER - 1) > /* The size of a free page block in bytes */ > -#define VIRTIO_BALLOON_FREE_PAGE_SIZE \ > -=09(1 << (VIRTIO_BALLOON_FREE_PAGE_ORDER + PAGE_SHIFT)) > +#define VIRTIO_BALLOON_HINT_BLOCK_BYTES \ > +=09(1 << (VIRTIO_BALLOON_HINT_BLOCK_ORDER + PAGE_SHIFT)) > =20 > #ifdef CONFIG_BALLOON_COMPACTION > static struct vfsmount *balloon_mnt; > @@ -380,7 +380,7 @@ static unsigned long return_free_pages_to_mm(struct v= irtio_balloon *vb, > =09=09if (!page) > =09=09=09break; > =09=09free_pages((unsigned long)page_address(page), > -=09=09=09 VIRTIO_BALLOON_FREE_PAGE_ORDER); > +=09=09=09 VIRTIO_BALLOON_HINT_BLOCK_ORDER); > =09} > =09vb->num_free_page_blocks -=3D num_returned; > =09spin_unlock_irq(&vb->free_page_list_lock); > @@ -582,7 +582,7 @@ static int get_free_page_and_send(struct virtio_ballo= on *vb) > =09=09; > =20 > =09page =3D alloc_pages(VIRTIO_BALLOON_FREE_PAGE_ALLOC_FLAG, > -=09=09=09 VIRTIO_BALLOON_FREE_PAGE_ORDER); > +=09=09=09 VIRTIO_BALLOON_HINT_BLOCK_ORDER); > =09/* > =09 * When the allocation returns NULL, it indicates that we have got a= ll > =09 * the possible free pages, so return -EINTR to stop. > @@ -591,13 +591,13 @@ static int get_free_page_and_send(struct virtio_bal= loon *vb) > =09=09return -EINTR; > =20 > =09p =3D page_address(page); > -=09sg_init_one(&sg, p, VIRTIO_BALLOON_FREE_PAGE_SIZE); > +=09sg_init_one(&sg, p, VIRTIO_BALLOON_HINT_BLOCK_BYTES); > =09/* There is always 1 entry reserved for the cmd id to use. */ > =09if (vq->num_free > 1) { > =09=09err =3D virtqueue_add_inbuf(vq, &sg, 1, p, GFP_KERNEL); > =09=09if (unlikely(err)) { > =09=09=09free_pages((unsigned long)p, > -=09=09=09=09 VIRTIO_BALLOON_FREE_PAGE_ORDER); > +=09=09=09=09 VIRTIO_BALLOON_HINT_BLOCK_ORDER); > =09=09=09return err; > =09=09} > =09=09virtqueue_kick(vq); > @@ -610,7 +610,7 @@ static int get_free_page_and_send(struct virtio_ballo= on *vb) > =09=09 * The vq has no available entry to add this page block, so > =09=09 * just free it. > =09=09 */ > -=09=09free_pages((unsigned long)p, VIRTIO_BALLOON_FREE_PAGE_ORDER); > +=09=09free_pages((unsigned long)p, VIRTIO_BALLOON_HINT_BLOCK_ORDER); > =09} > =20 > =09return 0; > @@ -765,11 +765,11 @@ static unsigned long shrink_free_pages(struct virti= o_balloon *vb, > =09unsigned long blocks_to_free, blocks_freed; > =20 > =09pages_to_free =3D round_up(pages_to_free, > -=09=09=09=09 1 << VIRTIO_BALLOON_FREE_PAGE_ORDER); > -=09blocks_to_free =3D pages_to_free >> VIRTIO_BALLOON_FREE_PAGE_ORDER; > +=09=09=09=09 1 << VIRTIO_BALLOON_HINT_BLOCK_ORDER); > +=09blocks_to_free =3D pages_to_free >> VIRTIO_BALLOON_HINT_BLOCK_ORDER; > =09blocks_freed =3D return_free_pages_to_mm(vb, blocks_to_free); > =20 > -=09return blocks_freed << VIRTIO_BALLOON_FREE_PAGE_ORDER; > +=09return blocks_freed << VIRTIO_BALLOON_HINT_BLOCK_ORDER; > } > =20 > static unsigned long leak_balloon_pages(struct virtio_balloon *vb, > @@ -825,7 +825,7 @@ static unsigned long virtio_balloon_shrinker_count(st= ruct shrinker *shrinker, > =09unsigned long count; > =20 > =09count =3D vb->num_pages / VIRTIO_BALLOON_PAGES_PER_PAGE; > -=09count +=3D vb->num_free_page_blocks << VIRTIO_BALLOON_FREE_PAGE_ORDER= ; > +=09count +=3D vb->num_free_page_blocks << VIRTIO_BALLOON_HINT_BLOCK_ORDE= R; > =20 > =09return count; > } >=20 Reviewed-by: David Hildenbrand --=20 Thanks, David / dhildenb