Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
f6adf918
Commit
f6adf918
authored
Jun 19, 2002
by
William Lee Irwin III
Committed by
Linus Torvalds
Jun 19, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] Re: convert BAD_RANGE() to an inline function
parent
9a89d96d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
mm/page_alloc.c
mm/page_alloc.c
+17
-13
No files found.
mm/page_alloc.c
View file @
f6adf918
...
...
@@ -44,14 +44,18 @@ static int zone_balance_min[MAX_NR_ZONES] __initdata = { 20 , 20, 20, };
static
int
zone_balance_max
[
MAX_NR_ZONES
]
__initdata
=
{
255
,
255
,
255
,
};
/*
* Temporary debugging check.
* Temporary debugging check
for pages not lying within a given zone
.
*/
#define BAD_RANGE(zone, page) \
( \
(((page) - mem_map) >= ((zone)->zone_start_mapnr+(zone)->size)) \
|| (((page) - mem_map) < (zone)->zone_start_mapnr) \
|| ((zone) != page_zone(page)) \
)
static
inline
int
bad_range
(
zone_t
*
zone
,
struct
page
*
page
)
{
if
(
page
-
mem_map
>=
zone
->
zone_start_mapnr
+
zone
->
size
)
return
1
;
if
(
page
-
mem_map
<
zone
->
zone_start_mapnr
)
return
1
;
if
(
zone
!=
page_zone
(
page
))
return
1
;
return
0
;
}
/*
* Freeing function for a buddy system allocator.
...
...
@@ -135,9 +139,9 @@ static void __free_pages_ok (struct page *page, unsigned int order)
*/
buddy1
=
base
+
(
page_idx
^
-
mask
);
buddy2
=
base
+
page_idx
;
if
(
BAD_RANGE
(
zone
,
buddy1
))
if
(
bad_range
(
zone
,
buddy1
))
BUG
();
if
(
BAD_RANGE
(
zone
,
buddy2
))
if
(
bad_range
(
zone
,
buddy2
))
BUG
();
list_del
(
&
buddy1
->
list
);
...
...
@@ -171,7 +175,7 @@ static inline struct page * expand (zone_t *zone, struct page *page,
unsigned
long
size
=
1
<<
high
;
while
(
high
>
low
)
{
if
(
BAD_RANGE
(
zone
,
page
))
if
(
bad_range
(
zone
,
page
))
BUG
();
area
--
;
high
--
;
...
...
@@ -181,7 +185,7 @@ static inline struct page * expand (zone_t *zone, struct page *page,
index
+=
size
;
page
+=
size
;
}
if
(
BAD_RANGE
(
zone
,
page
))
if
(
bad_range
(
zone
,
page
))
BUG
();
return
page
;
}
...
...
@@ -204,7 +208,7 @@ static struct page * rmqueue(zone_t *zone, unsigned int order)
unsigned
int
index
;
page
=
list_entry
(
curr
,
struct
page
,
list
);
if
(
BAD_RANGE
(
zone
,
page
))
if
(
bad_range
(
zone
,
page
))
BUG
();
list_del
(
curr
);
index
=
page
-
zone
->
zone_mem_map
;
...
...
@@ -216,7 +220,7 @@ static struct page * rmqueue(zone_t *zone, unsigned int order)
spin_unlock_irqrestore
(
&
zone
->
lock
,
flags
);
set_page_count
(
page
,
1
);
if
(
BAD_RANGE
(
zone
,
page
))
if
(
bad_range
(
zone
,
page
))
BUG
();
if
(
PageLRU
(
page
))
BUG
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment