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

From: Jörn Engel (joern@wohnheim.fh-wedel.de)
Date: Sat May 31 2003 - 03:15:18 EST


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/