Re: [Patch] shm bug introduced with pagecache in 2.3.11

Manfred (manfreds@colorfullife.com)
Fri, 12 Nov 1999 05:05:34 -0500 (EST)


>
> On 11 Nov 1999, Christoph Rohland wrote:
>
> >The patch also fixes some int/size_t issues.
> But this is a minor implementation issue. There is a worse problem. The
> real issue is that in SMP even removing the readahead is still racy. All
> the checks for the pte you added are racy.
The current code is UP only. There are new ipc helper function in
ipc/util.h and I'll convert the code RSN.

>
> This my patch should fix all races (both UP and SMP). Please try it out.
> It's against 2.3.27pre4. As the anonymous swapin we are protected by the
> per-mm semaphore, in shm we must protect us with a per-shm-segment
> semaphore to handle the swapin case safely. The design is almost the same
> as in the anonymous swapin then.
Intersting idea. I thought about acquiring the kernel lock a bit earlier,
but perhaps I can avoid that with a semaphore.

>
> The only ordering rule I added is that shm_lock must be acquired _before_
> pagecache_lock.
>
Yes.

> I am stressing the code with your shmtst on SMP and it works fine here.
>
> I suggest applying my race fixes to the stock kernel as the design looks
> like the right one to me now.
>
I don't like the semaphore, because (AFAICS, I'm only looking at the diff)
you single-thread the swapin code (per-segment, but still single thread)

I'll think about it,

Manfred

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/