From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751115AbdAQTYm (ORCPT ); Tue, 17 Jan 2017 14:24:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57926 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750830AbdAQTYl (ORCPT ); Tue, 17 Jan 2017 14:24:41 -0500 Date: Tue, 17 Jan 2017 21:15:45 +0200 From: "Michael S. Tsirkin" To: Liang Li Cc: kvm@vger.kernel.org, virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, amit.shah@redhat.com, dave.hansen@intel.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com, david@redhat.com, aarcange@redhat.com, dgilbert@redhat.com, quintela@redhat.com Subject: Re: [PATCH v6 kernel 3/5] virtio-balloon: speed up inflate/deflate process Message-ID: <20170117211131-mutt-send-email-mst@kernel.org> References: <1482303148-22059-1-git-send-email-liang.z.li@intel.com> <1482303148-22059-4-git-send-email-liang.z.li@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1482303148-22059-4-git-send-email-liang.z.li@intel.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 17 Jan 2017 19:15:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 21, 2016 at 02:52:26PM +0800, Liang Li wrote: > > - /* We should always be able to add one buffer to an empty queue. */ > - virtqueue_add_outbuf(vq, &sg, 1, vb, GFP_KERNEL); > - virtqueue_kick(vq); > +static void do_set_resp_bitmap(struct virtio_balloon *vb, > + unsigned long base_pfn, int pages) > > - /* When host has read buffer, this completes via balloon_ack */ > - wait_event(vb->acked, virtqueue_get_buf(vq, &len)); > +{ > + __le64 *range = vb->resp_data + vb->resp_pos; > > + if (pages > (1 << VIRTIO_BALLOON_NR_PFN_BITS)) { > + /* when the length field can't contain pages, set it to 0 to /* * Multi-line * comments * should look like this. */ Also, pls start sentences with an upper-case letter. > + * indicate the actual length is in the next __le64; > + */ This is part of the interface so should be documented as such. > + *range = cpu_to_le64((base_pfn << > + VIRTIO_BALLOON_NR_PFN_BITS) | 0); > + *(range + 1) = cpu_to_le64(pages); > + vb->resp_pos += 2; Pls use structs for this kind of stuff. > + } else { > + *range = (base_pfn << VIRTIO_BALLOON_NR_PFN_BITS) | pages; > + vb->resp_pos++; > + } > +}