aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/bank_proc.c
blob: 6103611211ce52b069fcf106a076d1ad9b18bcee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
/*
 * bank_proc.c -- Implementation of the page coloring for cache and bank partition. 
 *                The file will keep a pool of colored pages. Users can require pages with 
 *		  specific color or bank number.
 *                Part of the code is modified from Jonathan Herman's code  
 */
#include <linux/init.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sysctl.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/mutex.h>
#include <linux/mm.h>
#include <linux/random.h>

#include <litmus/litmus_proc.h>
#include <litmus/sched_trace.h>
#include <litmus/litmus.h>

#define LITMUS_LOCKDEP_NAME_MAX_LEN 50

// This Address Decoding is used in imx6-sabredsd platform
#define BANK_MASK  0x38000000     
#define BANK_SHIFT  27
#define CACHE_MASK  0x0000f000      
#define CACHE_SHIFT 12

#define PAGES_PER_COLOR 1024
unsigned int NUM_PAGE_LIST;  //8*16

unsigned int number_banks;
unsigned int number_cachecolors;

unsigned int set_partition_max = 0x0000ffff;
unsigned int set_partition_min = 0;
unsigned int bank_partition_max = 0x000000ff;
unsigned int bank_partition_min = 0;

int show_page_pool = 0;
int refill_page_pool = 0;
spinlock_t reclaim_lock;

unsigned int set_partition[9] = {
        0x00000003,  /* Core 0, and Level A*/
        0x00000003,  /* Core 0, and Level B*/
        0x0000000C,  /* Core 1, and Level A*/
        0x0000000C,  /* Core 1, and Level B*/
        0x00000030,  /* Core 2, and Level A*/
        0x00000030,  /* Core 2, and Level B*/
        0x000000C0,  /* Core 3, and Level A*/
        0x000000C0,  /* Core 3, and Level B*/
        0x0000ff00,  /* Level C */
};

unsigned int bank_partition[9] = {
        0x00000010,  /* Core 0, and Level A*/
        0x00000010,  /* Core 0, and Level B*/
        0x00000020,  /* Core 1, and Level A*/
        0x00000020,  /* Core 1, and Level B*/
        0x00000040,  /* Core 2, and Level A*/
        0x00000040,  /* Core 2, and Level B*/
        0x00000080,  /* Core 3, and Level A*/
        0x00000080,  /* Core 3, and Level B*/
        0x0000000c,  /* Level C */
};

unsigned int set_index[9] = {
    0, 0, 0, 0, 0, 0, 0, 0, 0
};

unsigned int bank_index[9] = {
    0, 0, 0, 0, 0, 0, 0, 0, 0
};

struct mutex void_lockdown_proc;


/*
 * Every page list should contain a lock, a list, and a number recording how many pages it store
 */ 
struct color_group {
	spinlock_t lock;
	char _lock_name[LITMUS_LOCKDEP_NAME_MAX_LEN];
	struct list_head list;
	atomic_t nr_pages;
};


static struct color_group *color_groups;

/*
 * Naive function to count the number of 1's
 */
unsigned int counting_one_set(unsigned int v)
{
//    unsigned int v; // count the number of bits set in v
    unsigned int c; // c accumulates the total bits set in v

    for (c = 0; v; v >>= 1)
    {
        c += v & 1;
    }
    return c;
}

unsigned int two_exp(unsigned int e)
{
    unsigned int v = 1;
    for (; e>0; e-- )
    {
        v=v*2;
    }
    return v;
}

unsigned int num_by_bitmask_index(unsigned int bitmask, unsigned int index)
{
    unsigned int pos = 0;

    while(true)
    {
        if(index ==0 && (bitmask & 1)==1)
        {
            break;
        }
        if(index !=0 && (bitmask & 1)==1){
            index--;
        }
        pos++;
        bitmask = bitmask >>1;

    }
    return pos;
}



/* Decoding page color, 0~15 */ 
static inline unsigned int page_color(struct page *page)
{
	return ((page_to_phys(page)& CACHE_MASK) >> CACHE_SHIFT);
}

/* Decoding page bank number, 0~7 */ 
static inline unsigned int page_bank(struct page *page)
{
	return ((page_to_phys(page)& BANK_MASK) >> BANK_SHIFT);
}

static inline unsigned int page_list_index(struct page *page)
{
    unsigned int idx;  
    idx = (page_color(page) + page_bank(page)*(number_cachecolors));
//    printk("address = %lx, ", page_to_phys(page));
//    printk("color(%d), bank(%d), indx = %d\n", page_color(page), page_bank(page), idx);

    return idx; 
}



/*
 * It is used to determine the smallest number of page lists. 
 */
static unsigned long smallest_nr_pages(void)
{
	unsigned long i, min_pages;
	struct color_group *cgroup;
	cgroup = &color_groups[16*2];
	min_pages =atomic_read(&cgroup->nr_pages); 
	for (i = 16*2; i < NUM_PAGE_LIST; ++i) {
		cgroup = &color_groups[i];
		if (atomic_read(&cgroup->nr_pages) < min_pages)
			min_pages = atomic_read(&cgroup->nr_pages);
	}
	return min_pages;
}

static void show_nr_pages(void)
{
	unsigned long i;
	struct color_group *cgroup;
	printk("show nr pages***************************************\n");
	for (i = 0; i < NUM_PAGE_LIST; ++i) {
		cgroup = &color_groups[i];
		printk("(%03d) =  %03d, ", i, atomic_read(&cgroup->nr_pages));
		if((i % 8) ==7){
		    printk("\n");
                }
	}
}

/*
 * Add a page to current pool.
 */
void add_page_to_color_list(struct page *page)
{
	const unsigned long color = page_list_index(page);
	struct color_group *cgroup = &color_groups[color];
	BUG_ON(in_list(&page->lru) || PageLRU(page));
	BUG_ON(page_count(page) > 1);
	spin_lock(&cgroup->lock);
	list_add_tail(&page->lru, &cgroup->list);
	atomic_inc(&cgroup->nr_pages);
	SetPageLRU(page);
	spin_unlock(&cgroup->lock);
}

/*
 * Replenish the page pool. 
 * If the newly allocate page is what we want, it will be pushed to the correct page list
 * otherwise, it will be freed. 
 */
static int do_add_pages(void)
{
	//printk("LITMUS do add pages\n");
	
	struct page *page, *page_tmp;
	LIST_HEAD(free_later);
	unsigned long color;
	int ret = 0;
	int i = 0;
	int free_counter = 0;
	unsigned long counter[128]= {0}; 
        
        //printk("Before refill : \n");
        //show_nr_pages();

	// until all the page lists contain enough pages 
	//for (i =0; i<5; i++) {
	for (i=0; i< 1024*100;i++) {
	//while (smallest_nr_pages() < PAGES_PER_COLOR) {
       //         printk("smallest = %d\n", smallest_nr_pages());	
		page = alloc_page(GFP_HIGHUSER_MOVABLE);
	    //    page = alloc_pages_exact_node(0, GFP_HIGHUSER_MOVABLE, 0);
	
		if (unlikely(!page)) {
			printk(KERN_WARNING "Could not allocate pages.\n");
			ret = -ENOMEM;
			goto out;
		}
		color = page_list_index(page);
		counter[color]++;
	//	printk("page(%d) = color %x, bank %x, [color] =%d \n", color, page_color(page), page_bank(page), atomic_read(&color_groups[color].nr_pages));
                //show_nr_pages();
		if (atomic_read(&color_groups[color].nr_pages) < PAGES_PER_COLOR && color>=32) {
		//if ( PAGES_PER_COLOR && color>=16*2) {
			add_page_to_color_list(page);
	//		printk("add page(%d) = color %x, bank %x\n", color, page_color(page), page_bank(page));
		} else{
			// Pages here will be freed later 
			list_add_tail(&page->lru, &free_later);
			free_counter++;
		        //list_del(&page->lru);
		//        __free_page(page);
	//		printk("useless page(%d) = color %x, bank %x\n", color,  page_color(page), page_bank(page));
		}
               //show_nr_pages();
                /*
                if(free_counter >= PAGES_PER_COLOR)
                {
                    printk("free unwanted page list eariler");
                    free_counter = 0;
	            list_for_each_entry_safe(page, page_tmp, &free_later, lru) {
		        list_del(&page->lru);
		        __free_page(page);
	            }

                    show_nr_pages();
                }
                */
        }
/*        printk("page counter = \n");
        for (i=0; i<128; i++)
        {
            printk("(%03d) = %4d, ", i , counter[i]);
            if(i%8 == 7){
                printk("\n");
            }

        }
*/	
        //printk("After refill : \n");
        //show_nr_pages();
#if 1
	// Free the unwanted pages
	list_for_each_entry_safe(page, page_tmp, &free_later, lru) {
		list_del(&page->lru);
		__free_page(page);
	}
#endif
out:
        return ret;
}

/*
 * Provide pages for replacement according cache color 
 * This should be the only implementation here
 * This function should not be accessed by others directly. 
 * 
 */ 
static struct  page *new_alloc_page_color( unsigned long color)
{
//	printk("allocate new page color = %d\n", color);	
	struct color_group *cgroup;
	struct page *rPage = NULL;
		
	if( (color <0) || (color)>(number_cachecolors*number_banks -1)) {
		TRACE_CUR("Wrong color %lu\n", color);	
//		printk(KERN_WARNING "Wrong color %lu\n", color);
		goto out;
	}

		
	cgroup = &color_groups[color];
	spin_lock(&cgroup->lock);
	if (unlikely(!atomic_read(&cgroup->nr_pages))) {
		TRACE_CUR("No free %lu colored pages.\n", color);
//		printk(KERN_WARNING "no free %lu colored pages.\n", color);
		goto out_unlock;
	}
	rPage = list_first_entry(&cgroup->list, struct page, lru);
	BUG_ON(page_count(rPage) > 1);
	//get_page(rPage);
	list_del(&rPage->lru);
	atomic_dec(&cgroup->nr_pages);
	ClearPageLRU(rPage);
out_unlock:
	spin_unlock(&cgroup->lock);
out:
	if( smallest_nr_pages() == 0)
        {
		do_add_pages();
       //     printk("ERROR(bank_proc.c) = We don't have enough pages in bank_proc.c\n");        
        
        }
	return rPage;
}

struct page* get_colored_page(unsigned long color)
{
	return new_alloc_page_color(color);
}

/*
 * provide pages for replacement according to  
 * node = 0 for Level A tasks in Cpu 0
 * node = 1 for Level B tasks in Cpu 0
 * node = 2 for Level A tasks in Cpu 1
 * node = 3 for Level B tasks in Cpu 1
 * node = 4 for Level A tasks in Cpu 2
 * node = 5 for Level B tasks in Cpu 2
 * node = 6 for Level A tasks in Cpu 3
 * node = 7 for Level B tasks in Cpu 3
 * node = 8 for Level C tasks 
 */
struct page *new_alloc_page(struct page *page, unsigned long node, int **x)
{
//	printk("allocate new page node = %d\n", node);	
//	return alloc_pages_exact_node(node, GFP_HIGHUSER_MOVABLE, 0);
	struct color_group *cgroup;
	struct page *rPage = NULL;
	unsigned int color;
	

        unsigned int idx = 0;
        idx += num_by_bitmask_index(set_partition[node], set_index[node]);
        idx += number_cachecolors* num_by_bitmask_index(bank_partition[node], bank_index[node]);
	//printk("node  = %d, idx = %d\n", node, idx);

	rPage =  new_alloc_page_color(idx);
        
            
        set_index[node] = (set_index[node]+1) % counting_one_set(set_partition[node]);
        bank_index[node] = (bank_index[node]+1) % counting_one_set(bank_partition[node]);
	return rPage; 
}


/*
 * Reclaim pages.
 */
void reclaim_page(struct page *page)
{
	const unsigned long color = page_list_index(page);
	unsigned long nr_reclaimed = 0;
	spin_lock(&reclaim_lock);
    	put_page(page);
	add_page_to_color_list(page);

	spin_unlock(&reclaim_lock);
	printk("Reclaimed page(%d) = color %x, bank %x, [color] =%d \n", color, page_color(page), page_bank(page), atomic_read(&color_groups[color].nr_pages));
}


/*
 * Initialize the numbers of banks and cache colors 
 */ 
static int __init init_variables(void)
{
	number_banks = counting_one_set(BANK_MASK); 
	number_banks = two_exp(number_banks); 

	number_cachecolors = counting_one_set(CACHE_MASK);
	number_cachecolors = two_exp(number_cachecolors);
	NUM_PAGE_LIST = number_banks * number_cachecolors; 
        printk(KERN_WARNING "number of banks = %d, number of cachecolors=%d\n", number_banks, number_cachecolors);
	mutex_init(&void_lockdown_proc);
	spin_lock_init(&reclaim_lock);

}


/*
 * Initialize the page pool 
 */
static int __init init_color_groups(void)
{
	struct color_group *cgroup;
	unsigned long i;
	int err = 0;

        printk("NUM_PAGE_LIST = %d\n", NUM_PAGE_LIST);
        color_groups = kmalloc(NUM_PAGE_LIST *sizeof(struct color_group), GFP_KERNEL);

	if (!color_groups) {
		printk(KERN_WARNING "Could not allocate color groups.\n");
		err = -ENOMEM;
	}else{

		for (i = 0; i < NUM_PAGE_LIST; ++i) {
			cgroup = &color_groups[i];
			atomic_set(&cgroup->nr_pages, 0);
			INIT_LIST_HEAD(&cgroup->list);
			spin_lock_init(&cgroup->lock);
		}
	}
        return err;
}

int set_partition_handler(struct ctl_table *table, int write, void __user *buffer,
		size_t *lenp, loff_t *ppos)
{
	int ret = 0, i = 0;
	mutex_lock(&void_lockdown_proc);
	ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
	if (ret)
		goto out;
	if (write) {
            printk("New set Partition : \n");
	    for(i =0;i <9;i++)
            {
                set_index[i] = 0;
                printk("set[%d] = %x \n", i, set_partition[i]);
            }
	}
out:
	mutex_unlock(&void_lockdown_proc);
	return ret;
}

int bank_partition_handler(struct ctl_table *table, int write, void __user *buffer,
		size_t *lenp, loff_t *ppos)
{
	int ret = 0, i = 0;
	mutex_lock(&void_lockdown_proc);
	ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
	if (ret)
		goto out;
	if (write) {
	    for(i =0;i <9;i++)
            {
                bank_index[i] = 0;
            }
	}
out:
	mutex_unlock(&void_lockdown_proc);
	return ret;
}

int show_page_pool_handler(struct ctl_table *table, int write, void __user *buffer,
		size_t *lenp, loff_t *ppos)
{
	int ret = 0, i = 0;
	mutex_lock(&void_lockdown_proc);
	ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
	if (ret)
		goto out;
	if (write) {
            show_nr_pages();
	}
out:
	mutex_unlock(&void_lockdown_proc);
	return ret;
}

int refill_page_pool_handler(struct ctl_table *table, int write, void __user *buffer,
		size_t *lenp, loff_t *ppos)
{
	int ret = 0, i = 0;
	mutex_lock(&void_lockdown_proc);
	ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
	if (ret)
		goto out;
	if (write) {
            do_add_pages();
	}
out:
	mutex_unlock(&void_lockdown_proc);
	return ret;
}

static struct ctl_table cache_table[] =
{
        
	{
		.procname	= "C0_LA_set",
		.mode		= 0666,
		.proc_handler	= set_partition_handler,
		.data		= &set_partition[0],
		.maxlen		= sizeof(set_partition[0]),
		.extra1		= &set_partition_min,
		.extra2		= &set_partition_max,
	},	
	{
		.procname	= "C0_LB_set",
		.mode		= 0666,
		.proc_handler	= set_partition_handler,
		.data		= &set_partition[1],
		.maxlen		= sizeof(set_partition[1]),
		.extra1		= &set_partition_min,
		.extra2		= &set_partition_max,
	},	
	{
		.procname	= "C1_LA_set",
		.mode		= 0666,
		.proc_handler	= set_partition_handler,
		.data		= &set_partition[2],
		.maxlen		= sizeof(set_partition[2]),
		.extra1		= &set_partition_min,
		.extra2		= &set_partition_max,
	},
	{
		.procname	= "C1_LB_set",
		.mode		= 0666,
		.proc_handler	= set_partition_handler,
		.data		= &set_partition[3],
		.maxlen		= sizeof(set_partition[3]),
		.extra1		= &set_partition_min,
		.extra2		= &set_partition_max,
	},
	{
		.procname	= "C2_LA_set",
		.mode		= 0666,
		.proc_handler	= set_partition_handler,
		.data		= &set_partition[4],
		.maxlen		= sizeof(set_partition[4]),
		.extra1		= &set_partition_min,
		.extra2		= &set_partition_max,
	},
	{
		.procname	= "C2_LB_set",
		.mode		= 0666,
		.proc_handler	= set_partition_handler,
		.data		= &set_partition[5],
		.maxlen		= sizeof(set_partition[5]),
		.extra1		= &set_partition_min,
		.extra2		= &set_partition_max,
	},
	{
		.procname	= "C3_LA_set",
		.mode		= 0666,
		.proc_handler	= set_partition_handler,
		.data		= &set_partition[6],
		.maxlen		= sizeof(set_partition[6]),
		.extra1		= &set_partition_min,
		.extra2		= &set_partition_max,
	},
	{
		.procname	= "C3_LB_set",
		.mode		= 0666,
		.proc_handler	= set_partition_handler,
		.data		= &set_partition[7],
		.maxlen		= sizeof(set_partition[7]),
		.extra1		= &set_partition_min,
		.extra2		= &set_partition_max,
	},	
	{
		.procname	= "Call_LC_set",
		.mode		= 0666,
		.proc_handler	= set_partition_handler,
		.data		= &set_partition[8],
		.maxlen		= sizeof(set_partition[8]),
		.extra1		= &set_partition_min,
		.extra2		= &set_partition_max,
	},	
	{
		.procname	= "C0_LA_bank",
		.mode		= 0666,
		.proc_handler	= bank_partition_handler,
		.data		= &bank_partition[0],
		.maxlen		= sizeof(set_partition[0]),
		.extra1		= &bank_partition_min,
		.extra2		= &bank_partition_max,
	},
	{
		.procname	= "C0_LB_bank",
		.mode		= 0666,
		.proc_handler	= bank_partition_handler,
		.data		= &bank_partition[1],
		.maxlen		= sizeof(set_partition[1]),
		.extra1		= &bank_partition_min,
		.extra2		= &bank_partition_max,
	},		
	{
		.procname	= "C1_LA_bank",
		.mode		= 0666,
		.proc_handler	= bank_partition_handler,
		.data		= &bank_partition[2],
		.maxlen		= sizeof(set_partition[2]),
		.extra1		= &bank_partition_min,
		.extra2		= &bank_partition_max,
	},
	{
		.procname	= "C1_LB_bank",
		.mode		= 0666,
		.proc_handler	= bank_partition_handler,
		.data		= &bank_partition[3],
		.maxlen		= sizeof(set_partition[3]),
		.extra1		= &bank_partition_min,
		.extra2		= &bank_partition_max,
	},
	{
		.procname	= "C2_LA_bank",
		.mode		= 0666,
		.proc_handler	= bank_partition_handler,
		.data		= &bank_partition[4],
		.maxlen		= sizeof(set_partition[4]),
		.extra1		= &bank_partition_min,
		.extra2		= &bank_partition_max,
	},	
	{
		.procname	= "C2_LB_bank",
		.mode		= 0666,
		.proc_handler	= bank_partition_handler,
		.data		= &bank_partition[5],
		.maxlen		= sizeof(set_partition[5]),
		.extra1		= &bank_partition_min,
		.extra2		= &bank_partition_max,
	},		
	{
		.procname	= "C3_LA_bank",
		.mode		= 0666,
		.proc_handler	= bank_partition_handler,
		.data		= &bank_partition[6],
		.maxlen		= sizeof(set_partition[6]),
		.extra1		= &bank_partition_min,
		.extra2		= &bank_partition_max,
	},	
	{
		.procname	= "C3_LB_bank",
		.mode		= 0666,
		.proc_handler	= bank_partition_handler,
		.data		= &bank_partition[7],
		.maxlen		= sizeof(set_partition[7]),
		.extra1		= &bank_partition_min,
		.extra2		= &bank_partition_max,
	},	
	{
		.procname	= "Call_LC_bank",
		.mode		= 0666,
		.proc_handler	= bank_partition_handler,
		.data		= &bank_partition[8],
		.maxlen		= sizeof(set_partition[8]),
		.extra1		= &bank_partition_min,
		.extra2		= &bank_partition_max,
	},	
	{
		.procname	= "show_page_pool",
		.mode		= 0666,
		.proc_handler	= show_page_pool_handler,
		.data		= &show_page_pool,
		.maxlen		= sizeof(show_page_pool),
	},		{
		.procname	= "refill_page_pool",
		.mode		= 0666,
		.proc_handler	= refill_page_pool_handler,
		.data		= &refill_page_pool,
		.maxlen		= sizeof(refill_page_pool),
	},	
	{ }
};

static struct ctl_table litmus_dir_table[] = {
	{
		.procname	= "litmus",
 		.mode		= 0555,
		.child		= cache_table,
	},
	{ }
};


static struct ctl_table_header *litmus_sysctls;


/*
 * Initialzie this proc 
 */
static int __init litmus_color_init(void)
{
	int err=0;
        printk("Init bankproc.c\n");

	init_variables();

	printk(KERN_INFO "Registering LITMUS^RT proc color sysctl.\n");

	litmus_sysctls = register_sysctl_table(litmus_dir_table);
	if (!litmus_sysctls) {
		printk(KERN_WARNING "Could not register LITMUS^RT color sysctl.\n");
		err = -EFAULT;
		goto out;
	}

	init_color_groups();			
	do_add_pages();

	printk(KERN_INFO "Registering LITMUS^RT color and bank proc.\n");
out:
	return err;
}

module_init(litmus_color_init);