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
9a0bd0e3
Commit
9a0bd0e3
authored
May 27, 2002
by
Andrew Morton
Committed by
Linus Torvalds
May 27, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] factor common code in page_alloc.c
Factor out some similar code in page_alloc.c
parent
28ea30f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
26 deletions
+12
-26
mm/page_alloc.c
mm/page_alloc.c
+12
-26
No files found.
mm/page_alloc.c
View file @
9a0bd0e3
...
...
@@ -543,16 +543,13 @@ unsigned int nr_free_pages (void)
return
sum
;
}
/*
* Amount of free RAM allocatable as buffer memory:
*/
unsigned
int
nr_free_buffer_pages
(
void
)
static
unsigned
int
nr_free_zone_pages
(
int
offset
)
{
pg_data_t
*
pgdat
=
pgdat_list
;
unsigned
int
sum
=
0
;
do
{
zonelist_t
*
zonelist
=
pgdat
->
node_zonelists
+
(
GFP_USER
&
GFP_ZONEMASK
)
;
zonelist_t
*
zonelist
=
pgdat
->
node_zonelists
+
offset
;
zone_t
**
zonep
=
zonelist
->
zones
;
zone_t
*
zone
;
...
...
@@ -570,30 +567,19 @@ unsigned int nr_free_buffer_pages (void)
}
/*
* Amount of free RAM allocatable
as pagecache memory:
* Amount of free RAM allocatable
within ZONE_DMA and ZONE_NORMAL
*/
unsigned
int
nr_free_
pagecache
_pages
(
void
)
unsigned
int
nr_free_
buffer
_pages
(
void
)
{
pg_data_t
*
pgdat
=
pgdat_list
;
unsigned
int
sum
=
0
;
do
{
zonelist_t
*
zonelist
=
pgdat
->
node_zonelists
+
(
GFP_HIGHUSER
&
GFP_ZONEMASK
);
zone_t
**
zonep
=
zonelist
->
zones
;
zone_t
*
zone
;
for
(
zone
=
*
zonep
++
;
zone
;
zone
=
*
zonep
++
)
{
unsigned
long
size
=
zone
->
size
;
unsigned
long
high
=
zone
->
pages_high
;
if
(
size
>
high
)
sum
+=
size
-
high
;
}
pgdat
=
pgdat
->
node_next
;
}
while
(
pgdat
);
return
nr_free_zone_pages
(
GFP_USER
&
GFP_ZONEMASK
);
}
return
sum
;
/*
* Amount of free RAM allocatable within all zones
*/
unsigned
int
nr_free_pagecache_pages
(
void
)
{
return
nr_free_zone_pages
(
GFP_HIGHUSER
&
GFP_ZONEMASK
);
}
#if CONFIG_HIGHMEM
...
...
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