xen-devel
[Xen-devel] [PATCH 08/22] Extend the grant tables implementation with an
The current batched allocation mechanism only allows grefs to be
withdrawn from the pre-allocated pool one at a time; the new scheme
allows them to be withdrawn in groups. There aren't currently any
users of this facility, but it will simplify some of the NC2 logic
(coming up shortly).
Signed-off-by: Steven Smith <steven.smith@xxxxxxxxxx>
---
drivers/xen/core/gnttab.c | 35 +++++++++++++++++++++++++++++++++++
include/xen/gnttab.h | 5 +++++
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/drivers/xen/core/gnttab.c b/drivers/xen/core/gnttab.c
index 02790fe..d5caf21 100644
--- a/drivers/xen/core/gnttab.c
+++ b/drivers/xen/core/gnttab.c
@@ -518,6 +518,41 @@ void gnttab_free_grant_references(grant_ref_t head)
}
EXPORT_SYMBOL_GPL(gnttab_free_grant_references);
+int gnttab_suballoc_grant_references(u16 count, grant_ref_t *old_head,
+ grant_ref_t *new_head)
+{
+ grant_ref_t cursor;
+ unsigned nr_allocated;
+
+ *new_head = cursor = *old_head;
+ if (cursor == GNTTAB_LIST_END)
+ return -ENOSPC;
+ nr_allocated = 1;
+ while (nr_allocated < count) {
+ cursor = gnttab_entry(cursor);
+ if (cursor == GNTTAB_LIST_END)
+ return -ENOSPC;
+ nr_allocated++;
+ }
+ *old_head = gnttab_entry(cursor);
+ gnttab_entry(cursor) = GNTTAB_LIST_END;
+ return 0;
+}
+EXPORT_SYMBOL_GPL(gnttab_suballoc_grant_references);
+
+void gnttab_subfree_grant_references(grant_ref_t head, grant_ref_t *pool)
+{
+ grant_ref_t cursor;
+
+ for (cursor = head;
+ gnttab_entry(cursor) != GNTTAB_LIST_END;
+ cursor = gnttab_entry(cursor))
+ ;
+ gnttab_entry(cursor) = *pool;
+ *pool = head;
+}
+EXPORT_SYMBOL_GPL(gnttab_subfree_grant_references);
+
int gnttab_alloc_grant_references(u16 count, grant_ref_t *head)
{
int h = get_free_entries(count);
diff --git a/include/xen/gnttab.h b/include/xen/gnttab.h
index 30be437..b4610d9 100644
--- a/include/xen/gnttab.h
+++ b/include/xen/gnttab.h
@@ -97,10 +97,15 @@ int gnttab_query_foreign_access(grant_ref_t ref);
*/
int gnttab_alloc_grant_references(u16 count, grant_ref_t *pprivate_head);
+int gnttab_suballoc_grant_references(u16 count, grant_ref_t *old_head,
+ grant_ref_t *new_head);
+
void gnttab_free_grant_reference(grant_ref_t ref);
void gnttab_free_grant_references(grant_ref_t head);
+void gnttab_subfree_grant_references(grant_ref_t head, grant_ref_t *pool);
+
int gnttab_empty_grant_references(const grant_ref_t *pprivate_head);
int gnttab_claim_grant_reference(grant_ref_t *pprivate_head);
--
1.6.3.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [PATCH 00/22] Netchannel2 patches for XCI 2.6.27, steven.smith
- [Xen-devel] [PATCH 03/22] Remove some trivial code duplication in gnttab.c., steven.smith
- [Xen-devel] [PATCH 06/22] Add support for copy only (sub-page) grants. These are like normal access grants, except:, steven.smith
- [Xen-devel] [PATCH 04/22] Fix a long-standing memory leak in the grant tables implementation. According to the interface comments, gnttab_end_foreign_access() is supposed to free the page once the grant is no longer in use, from a polling timer, but that was never implemented. Implement it., steven.smith
- [Xen-devel] [PATCH 02/22] Use the foreign page tracking logic in netback.c. This isn't terribly useful, but will be necessary if anything else ever introduces mappings of foreign pages into the network stack., steven.smith
- [Xen-devel] [PATCH 01/22] Introduce a live_maps facility for tracking which domain foreign pages were mapped from in a reasonably uniform way., steven.smith
- [Xen-devel] [PATCH 07/22] Add support for transitive grants., steven.smith
- [Xen-devel] [PATCH 08/22] Extend the grant tables implementation with an improved allocation batching mechanism.,
steven.smith <=
- [Xen-devel] [PATCH 05/22] Introduce support for version 2 grant tables. Use them by default when available., steven.smith
- [Xen-devel] [PATCH 09/22] Add a very basic netchannel2 implementation., steven.smith
- [Xen-devel] [PATCH 10/22] Add a fall-back poller, in case finish messages get stuck somewhere., steven.smith
- [Xen-devel] [PATCH 19/22] Add the basic VMQ APIs. Nobody uses or implements them at the moment, but that will change shortly., steven.smith
- [Xen-devel] [PATCH 21/22] NC2 VMQ support., steven.smith
- [Xen-devel] [PATCH 14/22] TSO support., steven.smith
- [Xen-devel] [PATCH 12/22] Scatter-gather support., steven.smith
- [Xen-devel] [PATCH 17/22] Add some userspace tools for managing the creation and destruction of bypass rings., steven.smith
- [Xen-devel] [PATCH 11/22] Transmit and receive checksum offload support., steven.smith
- [Xen-devel] [PATCH 13/22] Jumbogram support., steven.smith
|
|
|