lkml.org 
[lkml]   [2009]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] eventfd: reorganize the code to simplify new flags
On Thu, Aug 27, 2009 at 01:48:53PM +0200, Paolo Bonzini wrote:
> 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

Right, patch 2 actually fixed this back. The best thing is to open-code
it actually, since we handle it in a way that only applies to a counter,
anyway. Will post a fixed v1.

--
MST


\
 
 \ /
  Last update: 2009-08-27 14:03    [W:0.036 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site