~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-12-18 18:24:57 UTC
  • mfrom: (1999.6.3 trunk)
  • Revision ID: brian@tangent.org-20101218182457-yi1wd0so2hml1k1w
Merge in Lee's copyright header fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/******************************************************
2
 
The interface to the operating system
3
 
process control primitives
4
 
 
5
 
(c) 1995 Innobase Oy
6
 
 
7
 
Created 9/30/1995 Heikki Tuuri
8
 
*******************************************************/
9
 
 
10
 
#ifndef os0proc_h
11
 
#define os0proc_h
12
 
 
13
 
#include "univ.i"
14
 
 
15
 
#ifdef UNIV_LINUX
16
 
#include <sys/ipc.h>
17
 
#include <sys/shm.h>
18
 
#endif
19
 
 
20
 
typedef void*                   os_process_t;
21
 
typedef unsigned long int       os_process_id_t;
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
 
 
35
 
extern ibool os_use_large_pages;
36
 
/* Large page size. This may be a boot-time option on some platforms */
37
 
extern ulint os_large_page_size;
38
 
 
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
 
/********************************************************************
98
 
Converts the current process id to a number. It is not guaranteed that the
99
 
number is unique. In Linux returns the 'process number' of the current
100
 
thread. That number is the same as one sees in 'top', for example. In Linux
101
 
the thread id is not the same as one sees in 'top'. */
102
 
 
103
 
ulint
104
 
os_proc_get_number(void);
105
 
/*====================*/
106
 
/********************************************************************
107
 
Allocates non-cacheable memory. */
108
 
 
109
 
void*
110
 
os_mem_alloc_nocache(
111
 
/*=================*/
112
 
                        /* out: allocated memory */
113
 
        ulint   n);     /* in: number of bytes */
114
 
/********************************************************************
115
 
Allocates large pages memory. */
116
 
 
117
 
void*
118
 
os_mem_alloc_large(
119
 
/*===============*/
120
 
                                        /* out: allocated memory */
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 */
127
 
/********************************************************************
128
 
Frees large pages memory. */
129
 
 
130
 
void
131
 
os_mem_free_large(
132
 
/*==============*/
133
 
void    *ptr);  /* in: number of bytes */
134
 
/********************************************************************
135
 
Sets the priority boost for threads released from waiting within the current
136
 
process. */
137
 
 
138
 
void
139
 
os_process_set_priority_boost(
140
 
/*==========================*/
141
 
        ibool   do_boost);      /* in: TRUE if priority boost should be done,
142
 
                                FALSE if not */
143
 
 
144
 
#ifndef UNIV_NONINL
145
 
#include "os0proc.ic"
146
 
#endif
147
 
 
148
 
#endif