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
473e3e9d
Commit
473e3e9d
authored
Nov 23, 2007
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import 2.3.26
parent
28d0f062
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
mm/bootmem.c
mm/bootmem.c
+17
-12
No files found.
mm/bootmem.c
View file @
473e3e9d
...
...
@@ -36,9 +36,7 @@ unsigned long __init init_bootmem (unsigned long start, unsigned long pages)
{
unsigned
long
mapsize
=
(
pages
+
7
)
/
8
;
if
(
bootmem_map
)
BUG
();
bootmem_map
=
__va
(
start
<<
PAGE_SHIFT
);
bootmem_map
=
phys_to_virt
(
start
<<
PAGE_SHIFT
);
max_low_pfn
=
pages
;
/*
...
...
@@ -64,7 +62,6 @@ void __init reserve_bootmem (unsigned long addr, unsigned long size)
*/
unsigned
long
end
=
(
addr
+
size
+
PAGE_SIZE
-
1
)
/
PAGE_SIZE
;
if
(
!
bootmem_map
)
BUG
();
if
(
!
size
)
BUG
();
if
(
end
>
max_low_pfn
)
...
...
@@ -77,18 +74,23 @@ void __init reserve_bootmem (unsigned long addr, unsigned long size)
void
__init
free_bootmem
(
unsigned
long
addr
,
unsigned
long
size
)
{
unsigned
long
i
;
unsigned
long
start
;
/*
* round down end of usable mem, partially free pages are
* considered reserved.
*/
unsigned
long
end
=
(
addr
+
size
)
/
PAGE_SIZE
;
if
(
!
bootmem_map
)
BUG
();
if
(
!
size
)
BUG
();
if
(
end
>
max_low_pfn
)
BUG
();
for
(
i
=
addr
/
PAGE_SIZE
;
i
<
end
;
i
++
)
{
/*
* Round up the beginning of the address.
*/
start
=
(
addr
+
PAGE_SIZE
-
1
)
/
PAGE_SIZE
;
for
(
i
=
start
;
i
<
end
;
i
++
)
{
if
(
!
test_and_clear_bit
(
i
,
bootmem_map
))
BUG
();
}
...
...
@@ -117,7 +119,6 @@ void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned
unsigned
long
offset
,
remaining_size
;
unsigned
long
areasize
,
preferred
;
if
(
!
bootmem_map
)
BUG
();
if
(
!
size
)
BUG
();
/*
...
...
@@ -152,6 +153,9 @@ void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned
preferred
=
0
;
goto
restart_scan
;
}
/*
* Whoops, we cannot satisfy the allocation request.
*/
BUG
();
found:
if
(
start
>=
max_low_pfn
)
...
...
@@ -173,11 +177,11 @@ void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned
areasize
=
0
;
// last_pos unchanged
last_offset
=
offset
+
size
;
ret
=
__va
(
last_pos
*
PAGE_SIZE
+
offset
);
ret
=
phys_to_virt
(
last_pos
*
PAGE_SIZE
+
offset
);
}
else
{
size
-=
remaining_size
;
areasize
=
(
size
+
PAGE_SIZE
-
1
)
/
PAGE_SIZE
;
ret
=
__va
(
last_pos
*
PAGE_SIZE
+
offset
);
ret
=
phys_to_virt
(
last_pos
*
PAGE_SIZE
+
offset
);
last_pos
=
start
+
areasize
-
1
;
last_offset
=
size
;
}
...
...
@@ -185,7 +189,7 @@ void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned
}
else
{
last_pos
=
start
+
areasize
-
1
;
last_offset
=
size
&
~
PAGE_MASK
;
ret
=
__va
(
start
*
PAGE_SIZE
);
ret
=
phys_to_virt
(
start
*
PAGE_SIZE
);
}
/*
* Reserve the area now:
...
...
@@ -211,12 +215,13 @@ unsigned long __init free_all_bootmem (void)
count
++
;
ClearPageReserved
(
page
);
set_page_count
(
page
,
1
);
if
(
i
>=
(
__pa
(
MAX_DMA_ADDRESS
)
>>
PAGE_SHIFT
))
if
(
i
>=
(
virt_to_phys
((
char
*
)
MAX_DMA_ADDRESS
)
>>
PAGE_SHIFT
))
clear_bit
(
PG_DMA
,
&
page
->
flags
);
__free_page
(
page
);
}
}
total
+=
count
;
/*
* Now free the allocator bitmap itself, it's not
* needed anymore:
...
...
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