* padata - is serial actually serial?
@ 2016-06-14 21:00 Jason A. Donenfeld
2016-06-15 11:52 ` Steffen Klassert
0 siblings, 1 reply; 3+ messages in thread
From: Jason A. Donenfeld @ 2016-06-14 21:00 UTC (permalink / raw)
To: Steffen Klassert; +Cc: linux-crypto, Netdev
Hi Steffen & Folks,
I submit a job to padata_do_parallel(). When the parallel() function
triggers, I do some things, and then call padata_do_serial(). Finally
the serial() function triggers, where I complete the job (check a
nonce, etc).
The padata API is very appealing because not only does it allow for
parallel computation, but it claims that the serial() functions will
execute in the order that jobs were originally submitted to
padata_do_parallel().
Unfortunately, in practice, I'm pretty sure I'm seeing deviations from
this. When I submit tons and tons of tasks at rapid speed to
padata_do_parallel(), it seems like the serial() function isn't being
called in the exactly the same order that tasks were submitted to
padata_do_parallel().
Is this known (expected) behavior? Or have I stumbled upon a potential
bug that's worthwhile for me to investigate more?
Thanks,
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: padata - is serial actually serial?
2016-06-14 21:00 padata - is serial actually serial? Jason A. Donenfeld
@ 2016-06-15 11:52 ` Steffen Klassert
2016-06-15 13:53 ` Gary R Hook
0 siblings, 1 reply; 3+ messages in thread
From: Steffen Klassert @ 2016-06-15 11:52 UTC (permalink / raw)
To: Jason A. Donenfeld; +Cc: linux-crypto, Netdev
Hi Jason.
On Tue, Jun 14, 2016 at 11:00:54PM +0200, Jason A. Donenfeld wrote:
> Hi Steffen & Folks,
>
> I submit a job to padata_do_parallel(). When the parallel() function
> triggers, I do some things, and then call padata_do_serial(). Finally
> the serial() function triggers, where I complete the job (check a
> nonce, etc).
>
> The padata API is very appealing because not only does it allow for
> parallel computation, but it claims that the serial() functions will
> execute in the order that jobs were originally submitted to
> padata_do_parallel().
>
> Unfortunately, in practice, I'm pretty sure I'm seeing deviations from
> this. When I submit tons and tons of tasks at rapid speed to
> padata_do_parallel(), it seems like the serial() function isn't being
> called in the exactly the same order that tasks were submitted to
> padata_do_parallel().
>
> Is this known (expected) behavior? Or have I stumbled upon a potential
> bug that's worthwhile for me to investigate more?
It should return in the same order as the job were submitted,
given that the submitting cpu and the callback cpu are fixed
for all the jobs you want to preserve the order. If you submit
jobs from more than one cpu, we can not know in which order
they are enqueued. The cpu that gets the lock as the first
has its job in front. Same if you use more than one callback cpu
we can't know in which order they are dequeued, because the
serial workers are scheduled independent on each cpu.
I use it in crypto/pcrypt.c and I never had problems.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: padata - is serial actually serial?
2016-06-15 11:52 ` Steffen Klassert
@ 2016-06-15 13:53 ` Gary R Hook
0 siblings, 0 replies; 3+ messages in thread
From: Gary R Hook @ 2016-06-15 13:53 UTC (permalink / raw)
To: Steffen Klassert, Jason A. Donenfeld; +Cc: linux-crypto, Netdev
On 06/15/2016 06:52 AM, Steffen Klassert wrote:
> Hi Jason.
>
> On Tue, Jun 14, 2016 at 11:00:54PM +0200, Jason A. Donenfeld wrote:
>> Hi Steffen & Folks,
>>
>> I submit a job to padata_do_parallel(). When the parallel() function
>> triggers, I do some things, and then call padata_do_serial(). Finally
>> the serial() function triggers, where I complete the job (check a
>> nonce, etc).
>>
>> The padata API is very appealing because not only does it allow for
>> parallel computation, but it claims that the serial() functions will
>> execute in the order that jobs were originally submitted to
>> padata_do_parallel().
>>
>> Unfortunately, in practice, I'm pretty sure I'm seeing deviations from
>> this. When I submit tons and tons of tasks at rapid speed to
>> padata_do_parallel(), it seems like the serial() function isn't being
>> called in the exactly the same order that tasks were submitted to
>> padata_do_parallel().
>>
>> Is this known (expected) behavior? Or have I stumbled upon a potential
>> bug that's worthwhile for me to investigate more?
>
> It should return in the same order as the job were submitted,
> given that the submitting cpu and the callback cpu are fixed
> for all the jobs you want to preserve the order. If you submit
> jobs from more than one cpu, we can not know in which order
> they are enqueued. The cpu that gets the lock as the first
> has its job in front.
Isn't there an element of indeterminacy at the application thread level
(i.e. user space) too? We don't know how the jobs are being submitted, but
unless that is being handled by a single thread in a single process, I
think all bets are off with respect to ordering.
Then again, perhaps I'm not grokking the details here.
> Same if you use more than one callback cpu
> we can't know in which order they are dequeued, because the
> serial workers are scheduled independent on each cpu.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-15 13:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-14 21:00 padata - is serial actually serial? Jason A. Donenfeld
2016-06-15 11:52 ` Steffen Klassert
2016-06-15 13:53 ` Gary R Hook
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).