From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753686AbdBDEfr convert rfc822-to-8bit (ORCPT ); Fri, 3 Feb 2017 23:35:47 -0500 Received: from mga05.intel.com ([192.55.52.43]:32401 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753525AbdBDEfp (ORCPT ); Fri, 3 Feb 2017 23:35:45 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,332,1477983600"; d="scan'208";a="61720168" From: "Li, Liang Z" To: "Dr. David Alan Gilbert" 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" , "Hansen, Dave" , "cornelia.huck@de.ibm.com" , "pbonzini@redhat.com" , "mst@redhat.com" , "david@redhat.com" , "aarcange@redhat.com" , "quintela@redhat.com" Subject: RE: [PATCH v6 kernel 3/5] virtio-balloon: speed up inflate/deflate process Thread-Topic: [PATCH v6 kernel 3/5] virtio-balloon: speed up inflate/deflate process Thread-Index: AQHSW1evV/kH7yiC1ku9/YmVsAmoeKFA6ViAgBefuSA= Date: Sat, 4 Feb 2017 04:35:41 +0000 Message-ID: References: <1482303148-22059-1-git-send-email-liang.z.li@intel.com> <1482303148-22059-4-git-send-email-liang.z.li@intel.com> <20170120114809.GH2658@work-vm> In-Reply-To: <20170120114809.GH2658@work-vm> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > +static void free_extended_page_bitmap(struct virtio_balloon *vb) { > > + int i, bmap_count = vb->nr_page_bmap; > > + > > + for (i = 1; i < bmap_count; i++) { > > + kfree(vb->page_bitmap[i]); > > + vb->page_bitmap[i] = NULL; > > + vb->nr_page_bmap--; > > + } > > +} > > + > > +static void kfree_page_bitmap(struct virtio_balloon *vb) { > > + int i; > > + > > + for (i = 0; i < vb->nr_page_bmap; i++) > > + kfree(vb->page_bitmap[i]); > > +} > > It might be worth commenting that pair of functions to make it clear why > they are so different; I guess the kfree_page_bitmap is used just before you > free the structure above it so you don't need to keep the count/pointers > updated? > Yes. I will add some comments for that. Thanks! Liang > Dave > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK