From: kanoj@google.engr.sgi.com (Kanoj Sarcar)
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: torvalds@transmeta.com, number6@the-village.bc.nu,
Linux-MM@kvack.org, linux-kernel@vger.rutgers.edu
Subject: Re: RFC: patch for suspected shm swap problem
Date: Fri, 23 Apr 1999 08:48:37 -0700 (PDT) [thread overview]
Message-ID: <199904231548.IAA40539@google.engr.sgi.com> (raw)
In-Reply-To: <14112.29896.111556.997365@dukat.scot.redhat.com> from "Stephen C. Tweedie" at Apr 23, 99 02:25:28 pm
>
> Hi,
>
> On Thu, 22 Apr 1999 09:03:14 -0700 (PDT), kanoj@google.engr.sgi.com
> (Kanoj Sarcar) said:
>
> > I suspect the problem is that shm_swap bumps up swap_id to more
> > than max_shmid under some circumstances, leading the next call
> > to shm_swap to trip. Note that valid values of max_shmid are 0 ..
> > SHMMNI - 1, but shm_swap can leave swap_id set to SHMMNI.
>
> > MMU code maintainers, could you please review the patch and let
> > me know whether it is good
>
> Agreed: the patch looks correct.
>
> In particular, with the patch in place we are still protected against
> having max_shmid shrink between calls to shm_swap(): the worst that can
> happen is that we find an unused shm_seg which will get caught by the
> IPC_UNUSED test near the top of shm_swap. Only if the shm table is
> full, and so the swap_id overflow forces the next shm_segs[swap_id] to
> point to an entry not preinitialised to IPC_UNUSED or IPC_NOID, will
> there be a danger, and the patch makes sure that we never overstep that
> bound. (This probably explains why we haven't seen the problem before:
> were you allocating the maximum number of shm segments during the stress
> test?)
Yes ... my benchmark is so resource hungry that I had to end up also
bumping _SHM_ID_BITS to increase the number of shm segs, but that's
irrelevant.
Thanks.
Kanoj
>
> --Stephen
>
> ----------------------------------------------------------------
> From: kanoj@google.engr.sgi.com (Kanoj Sarcar)
> Sender: owner-linux-kernel@vger.rutgers.edu
> To: Linux-MM@kvack.org, linux-kernel@vger.rutgers.edu
> Subject: RFC: patch for suspected shm swap problem
> Date: Thu, 22 Apr 1999 09:03:14 -0700 (PDT)
>
> Hi,
>
> While running some heavy stress on shm code, I took a panic in
> shm_swap coming out of do_try_to_free_pages in the context of
> non-kswapd processes. From the register display, I suspect the
> problem to be fixed by this patch:
>
> --- /usr/tmp/p_rdiff_a000PE/shm.c Tue Apr 20 16:07:02 1999
> +++ kern/ipc/shm.c Tue Apr 20 16:05:54 1999
> @@ -716,10 +716,10 @@
> next_id:
> swap_idx = 0;
> if (++swap_id > max_shmid) {
> + swap_id = 0;
> if (loop)
> goto failed;
> loop = 1;
> - swap_id = 0;
> }
> goto check_id;
> }
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm my@address'
> in the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://humbolt.geo.uu.nl/Linux-MM/
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm my@address'
in the body to majordomo@kvack.org. For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/
prev parent reply other threads:[~1999-04-23 15:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-22 16:03 Kanoj Sarcar
1999-04-23 13:25 ` Stephen C. Tweedie
1999-04-23 15:48 ` Kanoj Sarcar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199904231548.IAA40539@google.engr.sgi.com \
--to=kanoj@google.engr.sgi.com \
--cc=Linux-MM@kvack.org \
--cc=linux-kernel@vger.rutgers.edu \
--cc=number6@the-village.bc.nu \
--cc=sct@redhat.com \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox