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:	Wed, 15 Apr 2009 17:29:36 +0200
From:	Philipp Reisner <philipp.reisner@...bit.com>
To:	Nikanth Karthikesan <knikanth@...e.de>
Cc:	linux-kernel@...r.kernel.org, Jens Axboe <jens.axboe@...cle.com>,
	Greg KH <gregkh@...e.de>, Neil Brown <neilb@...e.de>,
	James Bottomley <James.Bottomley@...senpartnership.com>,
	Andi Kleen <andi@...stfloor.org>,
	Sam Ravnborg <sam@...nborg.org>, Dave Jones <davej@...hat.com>,
	"Lars Marowsky-Bree" <lmb@...e.de>,
	"Nicholas A. Bellinger" <nab@...ux-iscsi.org>,
	Lars Ellenberg <lars.ellenberg@...bit.com>
Subject: Re: [PATCH 02/14] DRBD: lru_cache

[...]
> > +struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr)
> > +{
> > +	struct hlist_node *n;
> > +	struct lc_element *e;
> > +
> > +	BUG_ON(!lc);
> > +	BUG_ON(!lc->nr_elements);
>
> This BUG_ON() could be moved/added to lc_init().
>

You are right. Done.

> > +struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr)
> > +{
> > +	struct lc_element *e;
> > +
> > +	BUG_ON(!lc);
> > +	BUG_ON(!lc->nr_elements);
> > +
> > +	PARANOIA_ENTRY();
> > +	if (lc->flags & LC_STARVING) {
> > +		++lc->starving;
> > +		RETURN(NULL);
> > +	}
> > +
>
> Even if LC_STARVING, the element could still be available in the cache?
> Shouldn't this check be done after lc_find()?
>

[...]
> > +/* similar to lc_get,
> > + * but only gets a new reference on an existing element.
> > + * you either get the requested element, or NULL.
> > + */
> > +struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr)
> > +{
> > +	struct lc_element *e;
> > +
> > +	BUG_ON(!lc);
> > +	BUG_ON(!lc->nr_elements);
> > +
> > +	PARANOIA_ENTRY();
> > +	if (lc->flags & LC_STARVING) {
> > +		++lc->starving;
> > +		RETURN(NULL);
> > +	}
> > +
>
> This check shouldn't be done at all, as we are not at all trying to add a
> new element?
>

That check is okay. 

We set LC_STARVING if we need to change a cache slot to an other object
of the space of cacheable objects, but not a single slot was available.

If LC_STARVING is set we do not give out any further references, since we
want to finish that ongoing single object change first.

With this policy the changes in the LRU cache will never deadlock, and
eventually delay others trying to get new references to already cached 
objects.

-Phil
-- 
: Dipl-Ing Philipp Reisner
: LINBIT | Your Way to High Availability
: Tel: +43-1-8178292-50, Fax: +43-1-8178292-82
: http://www.linbit.com

DRBD(R) and LINBIT(R) are registered trademarks of LINBIT, Austria.

--
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