From: Paolo Bonzini <bonzini@gnu.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: davidel@xmailserver.org, avi@redhat.com, gleb@redhat.com,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] eventfd: reorganize the code to simplify new flags
Date: Thu, 27 Aug 2009 13:48:53 +0200 [thread overview]
Message-ID: <4A9672A5.60004@gnu.org> (raw)
In-Reply-To: <20090820155703.GB8764@redhat.com>
On 08/20/2009 05:57 PM, Michael S. Tsirkin wrote:
> +static inline int eventfd_writeable(struct eventfd_ctx *ctx, u64 n)
> +{
> + return ULLONG_MAX - n> ctx->count;
> +}
> +
> +static inline void eventfd_dowrite(struct eventfd_ctx *ctx, u64 ucnt)
> +{
> + if (eventfd_writeable(ctx, ucnt))
> + ucnt = ULLONG_MAX - ctx->count;
> +
> + ctx->count += ucnt;
In any case, this usage of eventfd_writeable is wrong: the code was like
this:
- if (ULLONG_MAX - ctx->count < n)
- n = (int) (ULLONG_MAX - ctx->count);
- ctx->count += n;
+ eventfd_dowrite(ctx, n);
and so it should be !eventfd_writable. (This smelled when I was editing
patch 2, so I went back and checked patch 1).
Paolo
next prev parent reply other threads:[~2009-08-27 11:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1250783333.git.mst@redhat.com>
2009-08-20 15:57 ` Michael S. Tsirkin
2009-08-27 11:48 ` Paolo Bonzini [this message]
2009-08-27 11:58 ` Michael S. Tsirkin
2009-08-27 12:02 ` Michael S. Tsirkin
2009-08-20 15:57 ` [PATCH 2/2] eventfd: EFD_STATE flag Michael S. Tsirkin
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=4A9672A5.60004@gnu.org \
--to=bonzini@gnu.org \
--cc=avi@redhat.com \
--cc=davidel@xmailserver.org \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@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
Powered by JetHome