From: Stefan Hajnoczi <stefanha@gmail.com>
To: John Snow <jsnow@redhat.com>
Cc: marc.mari.barcelo@gmail.com, pbonzini@redhat.com,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/4] libqos: add a simple first-fit memory allocator
Date: Fri, 1 Aug 2014 16:08:25 +0100 [thread overview]
Message-ID: <20140801150825.GE11091@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <53DAB1A4.7030900@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1661 bytes --]
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.
That said, feel free to keep the functions if you want.
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-08-01 15:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-30 22:28 [Qemu-devel] [PATCH v2 0/4] libqos: add a simple first-fit memory allocator John Snow
2014-07-30 22:28 ` [Qemu-devel] [PATCH 1/4] libqos: Correct mask to align size to PAGE_SIZE in malloc-pc John Snow
2014-07-30 22:28 ` [Qemu-devel] [PATCH 2/4] libqos: Change free function called in malloc John Snow
2014-07-30 22:28 ` [Qemu-devel] [PATCH 3/4] libqos: add a simple first-fit memory allocator John Snow
2014-07-31 10:13 ` Stefan Hajnoczi
2014-07-31 21:14 ` John Snow
2014-08-01 15:08 ` Stefan Hajnoczi [this message]
2014-08-04 8:22 ` Markus Armbruster
2014-07-30 22:28 ` [Qemu-devel] [PATCH 4/4] qtest/ide: Uninitialize PC allocator John Snow
2014-07-31 10:14 ` [Qemu-devel] [PATCH v2 0/4] libqos: add a simple first-fit memory allocator Stefan Hajnoczi
-- strict thread matches above, loose matches on Subject: below --
2014-07-29 21:54 [Qemu-devel] [PATCH " John Snow
2014-07-29 21:54 ` [Qemu-devel] [PATCH 3/4] " John Snow
2014-07-30 15:24 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140801150825.GE11091@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=jsnow@redhat.com \
--cc=marc.mari.barcelo@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).