Re: [PATCH RFC] 1/2 central workspace for zlib

Jörn Engel
2003-05-31T08:11:07Z

On Sat, 31 May 2003 00:59:09 -0700, David S. Miller wrote:
>
> You can't leave the per-cpu workspace in an indeterminate
> state, you'll context switch and meanwhile that workspace will
> be used by another client or you'll next get scheduled on
> a different cpu and use a different workspace.

Did you read the patch?

When getting scheduled, the workspace remains associated with the
owning process ( z->workspace, z->ws_num ). Other processes trying to
grab a workspace will get put on a waitqueue ( zlib_workspace_sem ).

The workspace is not exactly per cpu, it is per process. Just the
amount of workspaces happens to be equal to the amount of cpus in the
system, but a couple more or less should work just as well.

In softirq context you would be right. Preempt is disabled anyway and
cpu affinity comes for free.

Jörn

--
A defeated army first battles and then seeks victory.
-- Sun Tzu