lkml.org 
[lkml]   [2018]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net-next v3 01/17] asm: simd context helper API
From
Date

> On Sep 13, 2018, at 6:52 AM, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
>> On Thu, Sep 13, 2018 at 7:03 AM Kevin Easton <kevin@guarana.org> wrote:
>> Yes. It's also how most get/put APIs already work in the kernel, eg
>> kref_get/put (mostly because they tend to be 'getting/putting' an
>> already-initialized object, though).
>
> Right; in this case the object wouldn't be initialized yet, which
> might defeat the purpose, since one advantage of the & way you
> mentioned is _put modifies the context.
>
> Andy - any opinions on this? The tl;dr is:
>
> 1) what we have now:
>
> simd_context_t simd_context = simd_get();
> for (item in items) {
> do_something(item);
> simd_context = simd_relax(simd_context);
> }
> simd_put();
>
> 2) what kevin is proposing:
>
> simd_context_t simd_context;
>
> simd_get(&simd_context);
> for (item in items) {
> do_something(item);
> simd_relax(&simd_context);
> }
> simd_put(&simd_context);
>
> I can see pros and cons of each approach.

I have no strong opinion, except that, if you paint the bikeshed “pass by value”, then simd_get and simd_relax should probably have warn_unused_result set.
\
 
 \ /
  Last update: 2018-09-15 21:59    [W:0.413 / U:1.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site