~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/os0proc.h

  • Committer: Brian Aker
  • Date: 2008-09-04 19:31:00 UTC
  • Revision ID: brian@tangent.org-20080904193100-l849hgghfy4urj43
Changing default character set from this point on.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
typedef void*                   os_process_t;
21
21
typedef unsigned long int       os_process_id_t;
22
22
 
 
23
/* The cell type in os_awe_allocate_mem page info */
 
24
#if defined(__WIN2000__) && defined(ULONG_PTR)
 
25
typedef ULONG_PTR       os_awe_t;
 
26
#else
 
27
typedef ulint           os_awe_t;
 
28
#endif
 
29
 
 
30
/* Physical page size when Windows AWE is used. This is the normal
 
31
page size of an Intel x86 processor. We cannot use AWE with 2 MB or 4 MB
 
32
pages. */
 
33
#define OS_AWE_X86_PAGE_SIZE    4096
 
34
 
23
35
extern ibool os_use_large_pages;
24
36
/* Large page size. This may be a boot-time option on some platforms */
25
37
extern ulint os_large_page_size;
26
38
 
27
39
/********************************************************************
 
40
Windows AWE support. Tries to enable the "lock pages in memory" privilege for
 
41
the current process so that the current process can allocate memory-locked
 
42
virtual address space to act as the window where AWE maps physical memory. */
 
43
 
 
44
ibool
 
45
os_awe_enable_lock_pages_in_mem(void);
 
46
/*=================================*/
 
47
                                /* out: TRUE if success, FALSE if error;
 
48
                                prints error info to stderr if no success */
 
49
/********************************************************************
 
50
Allocates physical RAM memory up to 64 GB in an Intel 32-bit x86
 
51
processor. */
 
52
 
 
53
ibool
 
54
os_awe_allocate_physical_mem(
 
55
/*=========================*/
 
56
                                /* out: TRUE if success */
 
57
        os_awe_t** page_info,   /* out, own: array of opaque data containing
 
58
                                the info for allocated physical memory pages;
 
59
                                each allocated 4 kB physical memory page has
 
60
                                one slot of type os_awe_t in the array */
 
61
        ulint     n_megabytes); /* in: number of megabytes to allocate */
 
62
/********************************************************************
 
63
Allocates a window in the virtual address space where we can map then
 
64
pages of physical memory. */
 
65
 
 
66
byte*
 
67
os_awe_allocate_virtual_mem_window(
 
68
/*===============================*/
 
69
                        /* out, own: allocated memory, or NULL if did not
 
70
                        succeed */
 
71
        ulint   size);  /* in: virtual memory allocation size in bytes, must
 
72
                        be < 2 GB */
 
73
/********************************************************************
 
74
With this function you can map parts of physical memory allocated with
 
75
the ..._allocate_physical_mem to the virtual address space allocated with
 
76
the previous function. Intel implements this so that the process page
 
77
tables are updated accordingly. A test on a 1.5 GHz AMD processor and XP
 
78
showed that this takes < 1 microsecond, much better than the estimated 80 us
 
79
for copying a 16 kB page memory to memory. But, the operation will at least
 
80
partially invalidate the translation lookaside buffer (TLB) of all
 
81
processors. Under a real-world load the performance hit may be bigger. */
 
82
 
 
83
ibool
 
84
os_awe_map_physical_mem_to_window(
 
85
/*==============================*/
 
86
                                        /* out: TRUE if success; the function
 
87
                                        calls exit(1) in case of an error */
 
88
        byte*           ptr,            /* in: a page-aligned pointer to
 
89
                                        somewhere in the virtual address
 
90
                                        space window; we map the physical mem
 
91
                                        pages here */
 
92
        ulint           n_mem_pages,    /* in: number of 4 kB mem pages to
 
93
                                        map */
 
94
        os_awe_t*       page_info);     /* in: array of page infos for those
 
95
                                        pages; each page has one slot in the
 
96
                                        array */
 
97
/********************************************************************
28
98
Converts the current process id to a number. It is not guaranteed that the
29
99
number is unique. In Linux returns the 'process number' of the current
30
100
thread. That number is the same as one sees in 'top', for example. In Linux
31
101
the thread id is not the same as one sees in 'top'. */
32
 
UNIV_INTERN
 
102
 
33
103
ulint
34
104
os_proc_get_number(void);
35
105
/*====================*/
36
106
/********************************************************************
37
107
Allocates non-cacheable memory. */
38
 
UNIV_INTERN
 
108
 
39
109
void*
40
110
os_mem_alloc_nocache(
41
111
/*=================*/
43
113
        ulint   n);     /* in: number of bytes */
44
114
/********************************************************************
45
115
Allocates large pages memory. */
46
 
UNIV_INTERN
 
116
 
47
117
void*
48
118
os_mem_alloc_large(
49
119
/*===============*/
50
120
                                        /* out: allocated memory */
51
 
        ulint*  n);                     /* in/out: number of bytes */
 
121
        ulint           n,              /* in: number of bytes */
 
122
        ibool           set_to_zero,    /* in: TRUE if allocated memory
 
123
                                        should be set to zero if
 
124
                                        UNIV_SET_MEM_TO_ZERO is defined */
 
125
        ibool           assert_on_error);/* in: if TRUE, we crash mysqld if
 
126
                                         the memory cannot be allocated */
52
127
/********************************************************************
53
128
Frees large pages memory. */
54
 
UNIV_INTERN
 
129
 
55
130
void
56
131
os_mem_free_large(
57
132
/*==============*/
58
 
        void    *ptr,                   /* in: pointer returned by
59
 
                                        os_mem_alloc_large() */
60
 
        ulint   size);                  /* in: size returned by
61
 
                                        os_mem_alloc_large() */
 
133
void    *ptr);  /* in: number of bytes */
62
134
/********************************************************************
63
135
Sets the priority boost for threads released from waiting within the current
64
136
process. */
65
 
UNIV_INTERN
 
137
 
66
138
void
67
139
os_process_set_priority_boost(
68
140
/*==========================*/