[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 12/18] qht: QEMU's fast, resizable and scalab
From: |
Emilio G. Cota |
Subject: |
Re: [Qemu-devel] [PATCH v5 12/18] qht: QEMU's fast, resizable and scalable Hash Table |
Date: |
Mon, 23 May 2016 01:35:26 -0400 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Sun, May 22, 2016 at 09:01:59 +0100, Alex Bennée wrote:
> Emilio G. Cota <address@hidden> writes:
> > A small update: I just got rid of all the atomic_read/set's that
> > apply to the hashes, since retries will take care of possible races.
>
> I guess the potential hash-clash from a partially read or set hash is
> handled by the eventual compare against a always valid pointer?
As long as we call the cmp function with a non-NULL pointer,
we're safe. Given that pointers are read and set atomically, the
'if (p)' check before calling the cmp function guarantees that we
won't cause a segfault. This also means that items removed from
the hash table must be freed after an RCU grace period, since readers
might still see the pointers and pass them to the cmp function.
I'll document this.
If there's a reader concurrent with a writer, it's possible that
the reader might read a partially-updated hash. That's fine because
the reader will retry anyway until it can see the effect
of the writer calling seqlock_write_end. The only important
concern here is to make sure the pointers are read/set atomically.
Emilio
- [Qemu-devel] [PATCH v5 14/18] qht: add test program, (continued)
- [Qemu-devel] [PATCH v5 14/18] qht: add test program, Emilio G. Cota, 2016/05/13
- [Qemu-devel] [PATCH v5 09/18] tb hash: hash phys_pc, pc, and flags with xxhash, Emilio G. Cota, 2016/05/13
- [Qemu-devel] [PATCH v5 11/18] qdist: add test program, Emilio G. Cota, 2016/05/13
- [Qemu-devel] [PATCH v5 12/18] qht: QEMU's fast, resizable and scalable Hash Table, Emilio G. Cota, 2016/05/13
- Re: [Qemu-devel] [PATCH v5 12/18] qht: QEMU's fast, resizable and scalable Hash Table, Sergey Fedorov, 2016/05/20
- Re: [Qemu-devel] [PATCH v5 12/18] qht: QEMU's fast, resizable and scalable Hash Table, Emilio G. Cota, 2016/05/20
- Re: [Qemu-devel] [PATCH v5 12/18] qht: QEMU's fast, resizable and scalable Hash Table, Emilio G. Cota, 2016/05/21
- Re: [Qemu-devel] [PATCH v5 12/18] qht: QEMU's fast, resizable and scalable Hash Table, Alex Bennée, 2016/05/22
- Re: [Qemu-devel] [PATCH v5 12/18] qht: QEMU's fast, resizable and scalable Hash Table,
Emilio G. Cota <=
- Re: [Qemu-devel] [PATCH v5 12/18] qht: QEMU's fast, resizable and scalable Hash Table, Sergey Fedorov, 2016/05/21
- Re: [Qemu-devel] [PATCH v5 12/18] qht: QEMU's fast, resizable and scalable Hash Table, Sergey Fedorov, 2016/05/23
Re: [Qemu-devel] [PATCH v5 00/18] tb hash improvements, Sergey Fedorov, 2016/05/23