Received: from eggs.gnu.org ([2001:4830:134:3::10]:38979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEDXV-0001BB-Lv for qemu-devel@nongnu.org; Mon, 04 Aug 2014 04:22:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEDXP-0005rb-IK for qemu-devel@nongnu.org; Mon, 04 Aug 2014 04:22:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEDXP-0005rX-9v for qemu-devel@nongnu.org; Mon, 04 Aug 2014 04:22:35 -0400 From: Markus Armbruster References: <1406759309-13742-1-git-send-email-jsnow@redhat.com> <1406759309-13742-4-git-send-email-jsnow@redhat.com> <20140731101351.GD25929@stefanha-thinkpad.redhat.com> <53DAB1A4.7030900@redhat.com> <20140801150825.GE11091@stefanha-thinkpad.redhat.com> Date: Mon, 04 Aug 2014 10:22:31 +0200 In-Reply-To: <20140801150825.GE11091@stefanha-thinkpad.redhat.com> (Stefan Hajnoczi's message of "Fri, 1 Aug 2014 16:08:25 +0100") Message-ID: <87k36obr5k.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 3/4] libqos: add a simple first-fit memory allocator List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: marc.mari.barcelo@gmail.com, pbonzini@redhat.com, John Snow , qemu-devel@nongnu.org, Stefan Hajnoczi Stefan Hajnoczi writes: > On Thu, Jul 31, 2014 at 05:14:12PM -0400, John Snow wrote: >> >> On 07/31/2014 06:13 AM, Stefan Hajnoczi wrote: >> >On Wed, Jul 30, 2014 at 06:28:28PM -0400, John Snow wrote: >> >>-static uint64_t pc_alloc(QGuestAllocator *allocator, size_t size) >> >>+static inline void mlist_insert(MemList *head, MemBlock *insr) >> >> { >> >>- PCAlloc *s = container_of(allocator, PCAlloc, alloc); >> >>- uint64_t addr; >> >>+ QTAILQ_INSERT_HEAD(head, insr, MLIST_ENTNAME); >> >>+} >> >>+ >> >>+static inline void mlist_append(MemList *head, MemBlock *node) >> >>+{ >> >>+ QTAILQ_INSERT_TAIL(head, node, MLIST_ENTNAME); >> >>+} >> >>+ >> >>+static inline void mlist_unlink(MemList *head, MemBlock *rem) >> >>+{ >> >>+ QTAILQ_REMOVE(head, rem, MLIST_ENTNAME); >> >>+} >> >For the same reasons as my comments about the macros, these trivial functions >> >are boilerplate. Why not use the QTAILQ macros directly? >> For /at least/ the append and insert cases, I desired call-by-value >> semantics. >> As a matter of taste, I find macros annoying for the reason that you cannot >> inline things such as: >> mlist_insert(list, mlist_new(...)); >> >> but unlink is certainly superfluous, and just something I did for some >> consistency. >> >> If there is a matter of style where in-line function call is to be avoided >> entirely, I'll just nix all of these trivial inlines. > > As a reviewer I prefer to see familiar APIs rather than a convenience > layer because it's extra stuff I need to keep in mind. Sticking to the > APIs makes it quicker for other QEMU developers to parse the code. Seconded. > That said, feel free to keep the functions if you want. Can't say, as I haven't studied the patch in detail.