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] [day] [month] [year] [list]
Message-ID: <20130611174238.GA8139@redhat.com>
Date:	Tue, 11 Jun 2013 19:42:38 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Kent Overstreet <koverstreet@...gle.com>
Cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	linux-aio@...ck.org, akpm@...ux-foundation.org,
	Tejun Heo <tj@...nel.org>,
	Christoph Lameter <cl@...ux-foundation.org>,
	Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH 17/21] Percpu tag allocator

On 06/10, Kent Overstreet wrote:
>
> On Wed, May 15, 2013 at 05:41:21PM +0200, Oleg Nesterov wrote:
> >
> > Do you really think that, say,
> >
> > 	unsigned tag_alloc(struct tag_pool *pool, bool wait)
> > 	{
> > 		struct tag_cpu_freelist *tags;
> > 		unsigned ret = 0;
> > 	retry:
> > 		tags = get_cpu_ptr(pool->tag_cpu);
> > 		local_irq_disable();
> > 		if (!tags->nr_free && pool->nr_free) {
> > 			spin_lock(&pool->wq.lock);
> > 			if (pool->nr_free)
> > 				move_tags(...);
> > 			spin_unlock(&pool->wq.lock);
> > 		}
> >
> > 		if (tags->nr_free)
> > 			ret = tags->free[--tags->nr_free];
> > 		local_irq_enable();
> > 		put_cpu_var(pool->tag_cpu);
> >
> > 		if (ret || !wait)
> > 			return ret;
> >
> > 		__wait_event(&pool->wq, pool->nr_free);
> > 		goto retry;
> > 	}
> >
> > will be much slower?
>
> The overhead from doing nested irqsave/restore() sucks. I've had it bite
> me hard with the recent aio work.

Not sure I understand... Only __wait_event() does irqsave/restore and
we are going to sleep anyway.

> But screw it, it's not going to matter
> that much here.

Yes.

And, imho, even if we need some optimizations here, it would be better
to make a separate patch backed by the numbers or at least the detailed
explanation.

> > Question. tag_free() does move_tags+wakeup if nr_free = pool->watermark * 2.
> > Perhaps it should should also take waitqueue_active() into account ?
> > tag_alloc() can sleep more than necessary, it seems.
>
> No.
>
> By "sleeping more than necessary" you mean sleeping when there's tags
> available on other percpu freelists.

Yes,

> That's just unavoidable if the thing's to be percpu - efficient use of
> available tags requires global knowledge. Sleeping less would require
> more global cacheline contention, and would defeat the purpose of this
> code.

Yes, yes, I understand, there is a tradeoff. Just it is still not clear
to me what would be better "in practice"... So,

> So when you're deciding how many tag structs to allocate, you just
> double the number you'd allocate otherwise when you're using this code.

I am not sure this is really needed.

But OK, I see your point, thanks.

Oleg.

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