提交 e0fb5815 编写于 作者: Z Zhang Yanfei 提交者: Linus Torvalds

mm: accurately document nr_free_*_pages functions with code comments

nr_free_zone_pages(), nr_free_buffer_pages() and nr_free_pagecache_pages()
are horribly badly named, so accurately document them with code comments
in case of the misuse of them.

[akpm@linux-foundation.org: tweak comments]
Reviewed-by: NRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: NZhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 5f4b9fc5
...@@ -2813,6 +2813,15 @@ void free_pages_exact(void *virt, size_t size) ...@@ -2813,6 +2813,15 @@ void free_pages_exact(void *virt, size_t size)
} }
EXPORT_SYMBOL(free_pages_exact); EXPORT_SYMBOL(free_pages_exact);
/**
* nr_free_zone_pages - count number of pages beyond high watermark
* @offset: The zone index of the highest zone
*
* nr_free_zone_pages() counts the number of counts pages which are beyond the
* high watermark within all zones at or below a given zone index. For each
* zone, the number of pages is calculated as:
* present_pages - high_pages
*/
static unsigned long nr_free_zone_pages(int offset) static unsigned long nr_free_zone_pages(int offset)
{ {
struct zoneref *z; struct zoneref *z;
...@@ -2833,8 +2842,11 @@ static unsigned long nr_free_zone_pages(int offset) ...@@ -2833,8 +2842,11 @@ static unsigned long nr_free_zone_pages(int offset)
return sum; return sum;
} }
/* /**
* Amount of free RAM allocatable within ZONE_DMA and ZONE_NORMAL * nr_free_buffer_pages - count number of pages beyond high watermark
*
* nr_free_buffer_pages() counts the number of pages which are beyond the high
* watermark within ZONE_DMA and ZONE_NORMAL.
*/ */
unsigned long nr_free_buffer_pages(void) unsigned long nr_free_buffer_pages(void)
{ {
...@@ -2842,8 +2854,11 @@ unsigned long nr_free_buffer_pages(void) ...@@ -2842,8 +2854,11 @@ unsigned long nr_free_buffer_pages(void)
} }
EXPORT_SYMBOL_GPL(nr_free_buffer_pages); EXPORT_SYMBOL_GPL(nr_free_buffer_pages);
/* /**
* Amount of free RAM allocatable within all zones * nr_free_pagecache_pages - count number of pages beyond high watermark
*
* nr_free_pagecache_pages() counts the number of pages which are beyond the
* high watermark within all zones.
*/ */
unsigned long nr_free_pagecache_pages(void) unsigned long nr_free_pagecache_pages(void)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册