All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segoon@openwall.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Manuel Lauss <manuel.lauss@googlemail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Richard Weinberger <richard@nod.at>,
	Marc Zyngier <marc.zyngier@arm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] shm: optimize exit_shm()
Date: Wed, 3 Aug 2011 23:41:21 +0400	[thread overview]
Message-ID: <20110803194121.GA6960@albatros> (raw)
In-Reply-To: <20110803192930.GA320@redhat.com>

On Wed, Aug 03, 2011 at 21:29 +0200, Oleg Nesterov wrote:
> On 08/03, Vasiliy Kulikov wrote:
> >
> > On Wed, Aug 03, 2011 at 21:08 +0200, Manuel Lauss wrote:
> > > > +
> > > >        /* Destroy all already created segments, but not mapped yet */
> > > >        down_write(&shm_ids(ns).rw_mutex);
> > > >        if (shm_ids(ns).in_use)
> > >
> > > This check here is now unnecessary, yes?
> >
> > No, as I said in the comment above, other task may be holding the mutex and
> > deleting the last shm segment.  So, current task will see in_use == 1
> > before down_write(), but == 0 after it.
> 
> And? Why we can not do idr_for_each() in this (unikely) case?

Because it's pointless.  idr_for_each() would not find any used segment.

> > > And this also fixes the oops.
> >
> > Yes, but it only hides the real problem - tasks' dependency on initialized
> > init_*_ns.
> 
> This is true, but your patch has the same dependency, but pretends
> it doesn't ;) and it complicates the code.

I didn't say that .in_use check fixes the oops.  The description says
nothing about it.  It does an optimization, which is said in the
description.

-- 
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments

  reply	other threads:[~2011-08-03 19:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-03 14:04 + shm-fix-a-race-between-shm_exit-and-shm_init.patch added to -mm tree Oleg Nesterov
2011-08-03 18:24 ` Vasiliy Kulikov
2011-08-03 18:26   ` [PATCH] shm: fix wrong tests Vasiliy Kulikov
2011-08-03 18:28   ` [PATCH] shm: optimize exit_shm() Vasiliy Kulikov
2011-08-03 19:08     ` Manuel Lauss
2011-08-03 19:16       ` Vasiliy Kulikov
2011-08-03 19:29         ` Oleg Nesterov
2011-08-03 19:41           ` Vasiliy Kulikov [this message]
2011-08-03 19:43             ` Oleg Nesterov
2011-08-03 19:21     ` Oleg Nesterov
2011-08-03 19:34       ` Vasiliy Kulikov
2011-08-03 19:39         ` Oleg Nesterov
2011-08-03 19:18   ` + shm-fix-a-race-between-shm_exit-and-shm_init.patch added to -mm tree Oleg Nesterov

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=20110803194121.GA6960@albatros \
    --to=segoon@openwall.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manuel.lauss@googlemail.com \
    --cc=marc.zyngier@arm.com \
    --cc=oleg@redhat.com \
    --cc=richard@nod.at \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.