Linux Kernel
3.7.1
|
#include <linux/highmem.h>
#include <linux/gfp.h>
#include <linux/cpu.h>
#include <linux/export.h>
#include "rds.h"
Go to the source code of this file.
Data Structures | |
struct | rds_page_remainder |
Functions | |
int | rds_page_copy_user (struct page *page, unsigned long offset, void __user *ptr, unsigned long bytes, int to_user) |
EXPORT_SYMBOL_GPL (rds_page_copy_user) | |
int | rds_page_remainder_alloc (struct scatterlist *scat, unsigned long bytes, gfp_t gfp) |
EXPORT_SYMBOL_GPL (rds_page_remainder_alloc) | |
void | rds_page_exit (void) |
EXPORT_SYMBOL_GPL | ( | rds_page_copy_user | ) |
EXPORT_SYMBOL_GPL | ( | rds_page_remainder_alloc | ) |
int rds_page_remainder_alloc | ( | struct scatterlist * | scat, |
unsigned long | bytes, | ||
gfp_t | gfp | ||
) |
rds_page_remainder_alloc - build up regions of a message.
: Scatter list for message : the number of bytes needed. : the waiting behaviour of the allocation
is always ored with __GFP_HIGHMEM. Callers must be prepared to kmap the pages, etc.
If is at least a full page then this just returns a page from alloc_page().
If is a partial page then this stores the unused region of the page in a per-cpu structure. Future partial-page allocations may be satisfied from that cached region. This lets us waste less memory on small allocations with minimal complexity. It works because the transmit path passes read-only page regions down to devices. They hold a page reference until they are done with the region.