玩转FPGA山寨版

看了《玩转FPGA》,写的不错,写写山寨版和大家交流!

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
/*
 * 内核中用page结构表示系统中每个物理页,结构位于
linux/mm.h
*/
struct page {
page_flags_t flags;
atomic_t _count;
atomic_t _mapcount;
unsigned long private;
struct address_space *mapping;
pgoff_t index;
struct list_head lru;
void *virtual;
};
/*
* 系统的页被划分为区,每个区用struct zone表示,定义在linux/mmzone.h
*/

struct zone {
spinlock_t lock;
unsigned long free_pages;
unsigned long pages_min;
unsigned long pages_low;
unsigned long pages_high;
unsigned long protection[MAX_NR_ZONES];
spinlock_t lru_lock;
struct list_head active_list;
struct list_head inactive_list;
unsigned long nr_scan_active;
unsigned long nr_scan_inactive;
unsigned long nr_active;
unsigned long nr_inactive;
int all_unreclaimable;
unsigned long pages_scanned;
int temp_priority;
int prev_priority;
struct free_area free_area[MAX_ORDER];
wait_queue_head_t *wait_table;
unsigned long wait_table_size;
unsigned long wait_table_bits;
struct per_cpu_pageset pageset[NR_CPUS];
struct pglist_data *zone_pgdat;
struct page *zone_mem_map;
unsigned long zone_start_pfn;
char *name;
unsigned long spanned_pages;
unsigned long present_pages;
};


/*
*slab描述符strcut slab用来描述每个slab
*/
struct slab {
struct list_head list; /* 满,部分满或者空链表*/
unsigned long colouroff; /* slab着色的偏移量 */
void *s_mem; /* 在slab中的第一个对象 */
unsigned int inuse; /* 已经分配的对象数 */
kmem_bufctl_t free; /* 第一个空闲对象,假如有的话 */
posted on 2011-06-24 08:59  Neddy11  阅读(353)  评论(0编辑  收藏  举报