11/*
2- * Copyright (C) 2001-2006 Silicon Graphics, Inc. All rights reserved.
2+ * Copyright (C) 2001-2008 Silicon Graphics, Inc. All rights reserved.
33 *
44 * This program is free software; you can redistribute it and/or modify it
55 * under the terms of version 2 of the GNU General Public License
@@ -177,12 +177,13 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid)
177177 * uncached_alloc_page
178178 *
179179 * @starting_nid: node id of node to start with, or -1
180+ * @n_pages: number of contiguous pages to allocate
180181 *
181- * Allocate 1 uncached page. Allocates on the requested node. If no
182- * uncached pages are available on the requested node, roundrobin starting
183- * with the next higher node.
182+ * Allocate the specified number of contiguous uncached pages on the
183+ * the requested node. If not enough contiguous uncached pages are available
184+ * on the requested node, roundrobin starting with the next higher node.
184185 */
185- unsigned long uncached_alloc_page (int starting_nid )
186+ unsigned long uncached_alloc_page (int starting_nid , int n_pages )
186187{
187188 unsigned long uc_addr ;
188189 struct uncached_pool * uc_pool ;
@@ -202,7 +203,8 @@ unsigned long uncached_alloc_page(int starting_nid)
202203 if (uc_pool -> pool == NULL )
203204 continue ;
204205 do {
205- uc_addr = gen_pool_alloc (uc_pool -> pool , PAGE_SIZE );
206+ uc_addr = gen_pool_alloc (uc_pool -> pool ,
207+ n_pages * PAGE_SIZE );
206208 if (uc_addr != 0 )
207209 return uc_addr ;
208210 } while (uncached_add_chunk (uc_pool , nid ) == 0 );
@@ -217,11 +219,12 @@ EXPORT_SYMBOL(uncached_alloc_page);
217219/*
218220 * uncached_free_page
219221 *
220- * @uc_addr: uncached address of page to free
222+ * @uc_addr: uncached address of first page to free
223+ * @n_pages: number of contiguous pages to free
221224 *
222- * Free a single uncached page .
225+ * Free the specified number of uncached pages .
223226 */
224- void uncached_free_page (unsigned long uc_addr )
227+ void uncached_free_page (unsigned long uc_addr , int n_pages )
225228{
226229 int nid = paddr_to_nid (uc_addr - __IA64_UNCACHED_OFFSET );
227230 struct gen_pool * pool = uncached_pools [nid ].pool ;
@@ -232,7 +235,7 @@ void uncached_free_page(unsigned long uc_addr)
232235 if ((uc_addr & (0XFUL << 60 )) != __IA64_UNCACHED_OFFSET )
233236 panic ("uncached_free_page invalid address %lx\n" , uc_addr );
234237
235- gen_pool_free (pool , uc_addr , PAGE_SIZE );
238+ gen_pool_free (pool , uc_addr , n_pages * PAGE_SIZE );
236239}
237240EXPORT_SYMBOL (uncached_free_page );
238241
0 commit comments