Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Sep 2007 00:46:29 +0200
From:      "Attilio Rao" <attilio@freebsd.org>
To:        "Pawel Jakub Dawidek" <pjd@freebsd.org>
Cc:        Kip Macy <kip.macy@gmail.com>, Perforce Change Reviews <perforce@freebsd.org>, Kip Macy <kmacy@freebsd.org>
Subject:   Re: PERFORCE change 126330 for review
Message-ID:  <3bbf2fe10709121546i375afaf5jc716f9f3609c35e9@mail.gmail.com>
In-Reply-To: <20070912223833.GC4909@garage.freebsd.pl>
References:  <200709120832.l8C8WLlm085731@repoman.freebsd.org> <20070912150017.GA3553@garage.freebsd.pl> <b1fa29170709121450r5f59430bqa13373fdf807cadc@mail.gmail.com> <3bbf2fe10709121530h6d0681c4xa247fe7d31cb2c2e@mail.gmail.com> <20070912223833.GC4909@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
2007/9/13, Pawel Jakub Dawidek <pjd@freebsd.org>:
> On Thu, Sep 13, 2007 at 12:30:26AM +0200, Attilio Rao wrote:
> > 2007/9/12, Kip Macy <kip.macy@gmail.com>:
> > > On 9/12/07, Pawel Jakub Dawidek <pjd@freebsd.org> wrote:
> > > > On Wed, Sep 12, 2007 at 08:32:21AM +0000, Kip Macy wrote:
> > > > > http://perforce.freebsd.org/chv.cgi?CH=126330
> > > > >
> > > > > Change 126330 by kmacy@kmacy_home:ethng on 2007/09/12 08:31:36
> > > > >
> > > > >       convert radix node head and route locks from mutexes to rwlocks
> > > > [...]
> > > > >               rt->rt_flags |= RTF_LLINFO;
> > > > > -             callout_init_mtx(&la->la_timer, &rt->rt_mtx,
> > > > > -                 CALLOUT_RETURNUNLOCKED);
> > > > > +             callout_init_rwlock(&la->la_timer, &rt->rt_lock,
> > > > > +                 CALLOUT_RETURNUNLOCKED_RW);
> > > > >
> > > >
> > > > Kip, don't add callout_init_rwlock() to the tree. I've
> > > > callout_init_lock() implemented that operates on any lock type, just
> > > > like condvar(9).
> > >
> > > point me to a diff
> >
> > I'm courious to know another thing instead.
> > As like condvar() works, it is allowed to before release and later
> > acquire the lock.
> > This scheme let you acquire the lock again following the previous
> > pattern for sx and rw locks (if for example you had a rwlock mantained
> > in write mode you will acquire it in the same way).
> > This is not applicable to callout, instead, as you have the lock
> > 'blank', so with double-kind locks (like rw and sx) how do you lock
> > it?
>
> Always write/exclusive.

When thinking about it I was thinking to add an argument to functions
in order to force from outside one of the two things (and maybe do
some macro games with them).

However write/exclusive one is reasonable for most usage.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3bbf2fe10709121546i375afaf5jc716f9f3609c35e9>