summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-05-22 19:54:25 +0200
committerJustus Winter <justus@gnupg.org>2016-05-22 19:54:25 +0200
commit4fd1aa9fe936ce03e47cd6d2cb11010360817138 (patch)
tree92e7f20fd1fc541b93f649a84e1a43c39dc38a10
parent5fd77c4e1482f6572667a95a2b036d15476c8501 (diff)
add patch series
-rw-r--r--debian/patches/pager-alloc0001-libpager-provide-pager_create_alloc.patch183
-rw-r--r--debian/patches/series1
2 files changed, 184 insertions, 0 deletions
diff --git a/debian/patches/pager-alloc0001-libpager-provide-pager_create_alloc.patch b/debian/patches/pager-alloc0001-libpager-provide-pager_create_alloc.patch
new file mode 100644
index 00000000..e78cb376
--- /dev/null
+++ b/debian/patches/pager-alloc0001-libpager-provide-pager_create_alloc.patch
@@ -0,0 +1,183 @@
+From 64f3ba423471b1f3ae06c1986e31d6484c23fdc2 Mon Sep 17 00:00:00 2001
+From: Justus Winter <justus@gnupg.org>
+Date: Sun, 22 May 2016 19:35:10 +0200
+Subject: [PATCH hurd] libpager: provide 'pager_create_alloc'
+
+Add a variant to 'pager_create' that allocates memory for the user
+hook next to the pager data increasing locality.
+
+* doc/hurd.texi: Document new function.
+* ext2fs/pager.c (pager_clear_user_data): Don't free 'upi'.
+(diskfs_get_filemap): Use the new function.
+* libpager/pager-create.c (_pager_create): New generic allocation
+function.
+(pager_create): Use the new generic function.
+(pager_create_alloc): New function.
+* libpager/pager.h (pager_create_alloc): New prototype.
+---
+ doc/hurd.texi | 5 +++++
+ ext2fs/pager.c | 25 +++++++++++--------------
+ libpager/pager-create.c | 50 ++++++++++++++++++++++++++++++++++++++++---------
+ libpager/pager.h | 8 ++++++++
+ 4 files changed, 65 insertions(+), 23 deletions(-)
+
+diff --git a/doc/hurd.texi b/doc/hurd.texi
+index 2bcf561..8428a77 100644
+--- a/doc/hurd.texi
++++ b/doc/hurd.texi
+@@ -1410,6 +1410,11 @@ create references to pagers by use of the relevant ports library
+ functions. On errors, return null and set @code{errno}.
+ @end deftypefun
+
++@deftypefun {struct pager *} pager_create_alloc (@w{size_t @var{u_pager_size}}, @w{struct port_bucket *@var{bucket}}, @w{boolean_t @var{may_cache}}, @w{memory_object_copy_strategy_t @var{copy_strategy}})
++Likewise, but allocate space for the user hook adjacent to the pager
++data.
++@end deftypefun
++
+ Once you are ready to turn over control to the pager library, you should
+ call @code{ports_manage_port_operations_multithread} on the
+ @var{bucket}, using @code{pager_demuxer} as the ports @var{demuxer}.
+diff --git a/ext2fs/pager.c b/ext2fs/pager.c
+index 485f69c..2ddce68 100644
+--- a/ext2fs/pager.c
++++ b/ext2fs/pager.c
+@@ -822,8 +822,6 @@ pager_clear_user_data (struct user_pager_info *upi)
+
+ diskfs_nrele_light (upi->node);
+ }
+-
+- free (upi);
+ }
+
+ /* This will be called when the ports library wants to drop weak references.
+@@ -1316,23 +1314,22 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot)
+ }
+ else
+ {
+- struct user_pager_info *upi =
+- malloc (sizeof (struct user_pager_info));
+- upi->type = FILE_DATA;
+- upi->node = node;
+- upi->max_prot = prot;
+- diskfs_nref_light (node);
+- diskfs_node_disknode (node)->pager =
+- pager_create (upi, file_pager_bucket, MAY_CACHE,
+- MEMORY_OBJECT_COPY_DELAY, 0);
+- if (diskfs_node_disknode (node)->pager == 0)
++ struct user_pager_info *upi;
++ pager = pager_create_alloc (sizeof *upi, file_pager_bucket,
++ MAY_CACHE, MEMORY_OBJECT_COPY_DELAY, 0);
++ if (pager == NULL)
+ {
+- diskfs_nrele_light (node);
+- free (upi);
+ pthread_spin_unlock (&node_to_page_lock);
+ return MACH_PORT_NULL;
+ }
+
++ upi = pager->upi;
++ upi->type = FILE_DATA;
++ upi->node = node;
++ upi->max_prot = prot;
++ diskfs_nref_light (node);
++ diskfs_node_disknode (node)->pager = pager;
++
+ /* A weak reference for being part of the node. */
+ ports_port_ref_weak (diskfs_node_disknode (node)->pager);
+
+diff --git a/libpager/pager-create.c b/libpager/pager-create.c
+index b583f02..b3b7c8f 100644
+--- a/libpager/pager-create.c
++++ b/libpager/pager-create.c
+@@ -17,21 +17,19 @@
+
+ #include "priv.h"
+
+-/* Create and return a new pager with user info UPI. */
+-struct pager *
+-pager_create (struct user_pager_info *upi,
+- struct port_bucket *bucket,
+- boolean_t may_cache,
+- memory_object_copy_strategy_t copy_strategy,
+- boolean_t notify_on_evict)
++static struct pager *
++_pager_create (size_t size,
++ struct port_bucket *bucket,
++ boolean_t may_cache,
++ memory_object_copy_strategy_t copy_strategy,
++ boolean_t notify_on_evict)
+ {
+ struct pager *p;
+
+- errno = ports_create_port (_pager_class, bucket, sizeof (struct pager), &p);
++ errno = ports_create_port (_pager_class, bucket, sizeof *p + size, &p);
+ if (errno)
+ return 0;
+
+- p->upi = upi;
+ p->pager_state = NOTINIT;
+ pthread_mutex_init (&p->interlock, NULL);
+ pthread_cond_init (&p->wakeup, NULL);
+@@ -50,6 +48,40 @@ pager_create (struct user_pager_info *upi,
+ return p;
+ }
+
++/* Create and return a new pager with user info UPI. */
++struct pager *
++pager_create (struct user_pager_info *upi,
++ struct port_bucket *bucket,
++ boolean_t may_cache,
++ memory_object_copy_strategy_t copy_strategy,
++ boolean_t notify_on_evict)
++{
++ struct pager *p;
++
++ p = _pager_create (0, bucket, may_cache, copy_strategy, notify_on_evict);
++ if (p)
++ p->upi = upi;
++
++ return p;
++}
++
++struct pager *
++pager_create_alloc (size_t u_pager_size,
++ struct port_bucket *bucket,
++ boolean_t may_cache,
++ memory_object_copy_strategy_t copy_strategy,
++ boolean_t notify_on_evict)
++{
++ struct pager *p;
++
++ p = _pager_create (u_pager_size, bucket, may_cache, copy_strategy,
++ notify_on_evict);
++ if (p)
++ p->upi = (struct user_pager_info *) ((char *) p + sizeof *p);
++
++ return p;
++}
++
+
+ /* This causes the function to be run at startup by compiler magic. */
+ static void create_class (void) __attribute__ ((constructor));
+diff --git a/libpager/pager.h b/libpager/pager.h
+index df4db68..d2a8d39 100644
+--- a/libpager/pager.h
++++ b/libpager/pager.h
+@@ -69,6 +69,14 @@ pager_create (struct user_pager_info *u_pager,
+ memory_object_copy_strategy_t copy_strategy,
+ boolean_t notify_on_evict);
+
++/* Likewise, but also allocate space for the user hook. */
++struct pager *
++pager_create_alloc (size_t u_pager_size,
++ struct port_bucket *bucket,
++ boolean_t may_cache,
++ memory_object_copy_strategy_t copy_strategy,
++ boolean_t notify_on_evict);
++
+ /* Return the user_pager_info struct associated with a pager. */
+ struct user_pager_info *
+ pager_get_upi (struct pager *p);
+--
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 0a3bced4..246db96e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -37,3 +37,4 @@ exec_filename0003-Use-the-new-_hurd_exec_file_name-function.patch
exec_filename0004-This-patch-is-an-amendment-of-exec_filename_exec.pat.patch
crash0001-xxx-crash-logging-works.patch
+pager-alloc0001-libpager-provide-pager_create_alloc.patch