Re: [PATCH 5/6] syslets: add generic syslets infrastructure
- From: Evgeniy Polyakov <johnpol@xxxxxxxxxxx>
- Date: Fri, 7 Dec 2007 14:55:05 +0300
Hi Zach.
On Thu, Dec 06, 2007 at 03:20:18PM -0800, Zach Brown (zach.brown@xxxxxxxxxx) wrote:
+/*
+ * XXX todo:
+ * - do we need all this '*cur = current' nonsense?
+ * - try to prevent userspace from submitting too much.. lazy user ptr read?
+ * - explain how to deal with waiting threads with stale data in current
+ * - how does userspace tell that a syslet completion was lost?
+ * provide an -errno argument to the userspace return function?
+ */
+
+/*
+ * These structs are stored on the kernel stack of tasks which are waiting to
+ * return to userspace. They are linked into their parent's list of syslet
+ * children stored in 'syslet_tasks' in the parent's task_struct.
+ */
+struct syslet_task_entry {
+ struct task_struct *task;
+ struct list_head item;
+};
+
+/*
+ * syslet_ring doesn't have any kernel-side storage. Userspace allocates them
+ * in their address space and initializes their fields and then passes them to
+ * the kernel.
+ *
+ * These hashes provide the kernel-side storage for the wait queues which
+ * sys_syslet_ring_wait() uses and the mutex which completion uses to serialize
+ * the (possible blocking) ordered writes of the completion and kernel head
+ * index into the ring.
+ *
+ * We chose the bucket that supports a given ring by hashing a u32 that
+ * userspace sets in the ring.
+ */
+#define SYSLET_HASH_BITS (CONFIG_BASE_SMALL ? 4 : 8)
+#define SYSLET_HASH_NR (1 << SYSLET_HASH_BITS)
+#define SYSLET_HASH_MASK (SYSLET_HASH_NR - 1)
+static wait_queue_head_t syslet_waitqs[SYSLET_HASH_NR];
+static struct mutex syslet_muts[SYSLET_HASH_NR];
Why do you care about hashed tables scalability and not using trees?
--
Evgeniy Polyakov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH 5/6] syslets: add generic syslets infrastructure
- From: Zach Brown
- Re: [PATCH 5/6] syslets: add generic syslets infrastructure
- References:
- syslets v7: back to basics
- From: Zach Brown
- [PATCH 1/6] indirect: use asmlinkage in i386 syscall table prototype
- From: Zach Brown
- [PATCH 2/6] syslet: asm-generic support to disable syslets
- From: Zach Brown
- [PATCH 3/6] syslet: introduce abi structs
- From: Zach Brown
- [PATCH 4/6] syslets: add indirect args
- From: Zach Brown
- [PATCH 5/6] syslets: add generic syslets infrastructure
- From: Zach Brown
- syslets v7: back to basics
- Prev by Date: RE: ptrace API extensions for BTS
- Next by Date: [PATCH] depmod: sort output according to modules.order, take #2
- Previous by thread: [PATCH 6/6] syslets: add both 32bit and 64bit x86 syslet support
- Next by thread: Re: [PATCH 5/6] syslets: add generic syslets infrastructure
- Index(es):
Relevant Pages
|