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
nexedi
linux
Commits
ea460046
Commit
ea460046
authored
Nov 02, 2002
by
Christoph Hellwig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] page_alloc.c uClinux bits
nommu ports need to set a reference on all allocated pages.
parent
ad0ec372
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
mm/page_alloc.c
mm/page_alloc.c
+22
-7
No files found.
mm/page_alloc.c
View file @
ea460046
...
...
@@ -213,13 +213,28 @@ expand(struct zone *zone, struct page *page,
return
page
;
}
static
inline
void
set_page_refs
(
struct
page
*
page
,
int
order
)
{
#ifdef CONFIG_MMU
set_page_count
(
page
,
1
);
#else
int
i
;
/*
* We need to reference all the pages for this order, otherwise if
* anyone accesses one of the pages with (get/put) it will be freed.
*/
for
(
i
=
0
;
i
<
(
1
<<
order
);
i
++
)
set_page_count
(
page
+
i
,
1
);
#endif
/* CONFIG_MMU */
}
/*
* This page is about to be returned from the page allocator
*/
static
void
prep_new_page
(
struct
page
*
page
)
static
void
prep_new_page
(
struct
page
*
page
,
int
order
)
{
if
(
page
->
mapping
||
page_mapped
(
page
)
||
if
(
page
->
mapping
||
page_mapped
(
page
)
||
(
page
->
flags
&
(
1
<<
PG_private
|
1
<<
PG_locked
|
...
...
@@ -232,7 +247,7 @@ static void prep_new_page(struct page *page)
page
->
flags
&=
~
(
1
<<
PG_uptodate
|
1
<<
PG_error
|
1
<<
PG_referenced
|
1
<<
PG_arch_1
|
1
<<
PG_checked
);
set_page_
count
(
page
,
1
);
set_page_
refs
(
page
,
order
);
}
/*
...
...
@@ -299,7 +314,7 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
list_for_each
(
curr
,
&
temp
)
{
page
=
list_entry
(
curr
,
struct
page
,
list
);
BUG_ON
(
bad_range
(
zone
,
page
));
prep_new_page
(
page
);
prep_new_page
(
page
,
order
);
}
list_splice
(
&
temp
,
list
->
prev
);
return
allocated
;
...
...
@@ -390,7 +405,7 @@ static struct page *buffered_rmqueue(struct zone *zone, int order, int cold)
if
(
page
!=
NULL
)
{
BUG_ON
(
bad_range
(
zone
,
page
));
prep_new_page
(
page
);
prep_new_page
(
page
,
order
);
}
return
page
;
}
...
...
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