lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 9 Oct 2015 21:11:33 +0300
From:	Sergei Zviagintsev <sergei@...v.net>
To:	David Herrmann <dh.herrmann@...il.com>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Daniel Mack <daniel@...que.org>,
	David Herrmann <dh.herrmann@...glemail.com>,
	Djalal Harouni <tixxdz@...ndz.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 05/44] kdbus: Add comment on merging free pool slices

Hi,

On Thu, Oct 08, 2015 at 03:50:46PM +0200, David Herrmann wrote:
> Hi
> 
> On Thu, Oct 8, 2015 at 1:31 PM, Sergei Zviagintsev <sergei@...v.net> wrote:
> > Add comment on why we remove the same slice from free slices tree and
> > then add it back again when merging the slice to be released with
> > previous free slice.
> >
> > Signed-off-by: Sergei Zviagintsev <sergei@...v.net>
> > ---
> >  ipc/kdbus/pool.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/ipc/kdbus/pool.c b/ipc/kdbus/pool.c
> > index 84afe96fbc22..c26ef963d8d1 100644
> > --- a/ipc/kdbus/pool.c
> > +++ b/ipc/kdbus/pool.c
> > @@ -304,6 +304,12 @@ static void __kdbus_pool_slice_release(struct kdbus_pool_slice *slice)
> >                 s = list_entry(slice->entry.prev,
> >                                struct kdbus_pool_slice, entry);
> >                 if (s->free) {
> > +                       /*
> > +                        * As size of slice increases after merge and free
> > +                        * slices tree is ordered by slice size, we have to
> > +                        * remove the slice from free slices tree and then add
> > +                        * it again to keep the tree balanced.
> > +                        */
> 
> Mhh, isn't this obvious? "slices_free" is ordered by s->size, so a
> change of the key requires a re-insert. If you disagree, maybe keep it
> simple:
> 
>         /* s->size changed, re-insert slice in rbtree */

It wasn't obvious for me from the first sight (but don't tell anyone),
so I decided that some words on why we're doing re-insert would be
helpful. It's up to you to decide whether it would be useful for the
others. BTW, I find your shorter variant better.

> 
> Thanks
> David
> 
> >                         rb_erase(&s->rb_node, &pool->slices_free);
> >                         list_del(&slice->entry);
> >                         s->size += slice->size;
> > --
> > 1.8.3.1
> >
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ