* [PATCH] mm/readahead.c, mm/vmscan.c: use lru_to_page instead of list_to_page
@ 2015-12-08 14:40 Geliang Tang
2015-12-18 17:25 ` Vlastimil Babka
0 siblings, 1 reply; 7+ messages in thread
From: Geliang Tang @ 2015-12-08 14:40 UTC (permalink / raw)
To: Andrew Morton, Tejun Heo, Jens Axboe, Michal Hocko,
Vladimir Davydov, Johannes Weiner, Vlastimil Babka
Cc: Geliang Tang, linux-mm, linux-kernel
list_to_page() in readahead.c is the same as lru_to_page() in vmscan.c.
So I move lru_to_page to internal.h and drop list_to_page().
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
mm/internal.h | 2 ++
mm/readahead.c | 8 +++-----
mm/vmscan.c | 2 --
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/mm/internal.h b/mm/internal.h
index 4ae7b7c..d01a41c 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -80,6 +80,8 @@ extern int isolate_lru_page(struct page *page);
extern void putback_lru_page(struct page *page);
extern bool zone_reclaimable(struct zone *zone);
+#define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))
+
/*
* in mm/rmap.c:
*/
diff --git a/mm/readahead.c b/mm/readahead.c
index ba22d7f..0aff760 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -32,8 +32,6 @@ file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping)
}
EXPORT_SYMBOL_GPL(file_ra_state_init);
-#define list_to_page(head) (list_entry((head)->prev, struct page, lru))
-
/*
* see if a page needs releasing upon read_cache_pages() failure
* - the caller of read_cache_pages() may have set PG_private or PG_fscache
@@ -64,7 +62,7 @@ static void read_cache_pages_invalidate_pages(struct address_space *mapping,
struct page *victim;
while (!list_empty(pages)) {
- victim = list_to_page(pages);
+ victim = lru_to_page(pages);
list_del(&victim->lru);
read_cache_pages_invalidate_page(mapping, victim);
}
@@ -87,7 +85,7 @@ int read_cache_pages(struct address_space *mapping, struct list_head *pages,
int ret = 0;
while (!list_empty(pages)) {
- page = list_to_page(pages);
+ page = lru_to_page(pages);
list_del(&page->lru);
if (add_to_page_cache_lru(page, mapping, page->index,
mapping_gfp_constraint(mapping, GFP_KERNEL))) {
@@ -125,7 +123,7 @@ static int read_pages(struct address_space *mapping, struct file *filp,
}
for (page_idx = 0; page_idx < nr_pages; page_idx++) {
- struct page *page = list_to_page(pages);
+ struct page *page = lru_to_page(pages);
list_del(&page->lru);
if (!add_to_page_cache_lru(page, mapping, page->index,
mapping_gfp_constraint(mapping, GFP_KERNEL))) {
diff --git a/mm/vmscan.c b/mm/vmscan.c
index c2f6944..f284401 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -106,8 +106,6 @@ struct scan_control {
unsigned long nr_reclaimed;
};
-#define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))
-
#ifdef ARCH_HAS_PREFETCH
#define prefetch_prev_lru_page(_page, _base, _field) \
do { \
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/readahead.c, mm/vmscan.c: use lru_to_page instead of list_to_page
2015-12-08 14:40 [PATCH] mm/readahead.c, mm/vmscan.c: use lru_to_page instead of list_to_page Geliang Tang
@ 2015-12-18 17:25 ` Vlastimil Babka
0 siblings, 0 replies; 7+ messages in thread
From: Vlastimil Babka @ 2015-12-18 17:25 UTC (permalink / raw)
To: Geliang Tang, Andrew Morton, Tejun Heo, Jens Axboe, Michal Hocko,
Vladimir Davydov, Johannes Weiner
Cc: linux-mm, linux-kernel
On 12/08/2015 03:40 PM, Geliang Tang wrote:
> list_to_page() in readahead.c is the same as lru_to_page() in vmscan.c.
> So I move lru_to_page to internal.h and drop list_to_page().
Looks like this would topically fit better to include/linux/mm_inline.h
Vlastimil
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/readahead.c, mm/vmscan.c: use lru_to_page instead of list_to_page
@ 2015-12-18 17:25 ` Vlastimil Babka
0 siblings, 0 replies; 7+ messages in thread
From: Vlastimil Babka @ 2015-12-18 17:25 UTC (permalink / raw)
To: Geliang Tang, Andrew Morton, Tejun Heo, Jens Axboe, Michal Hocko,
Vladimir Davydov, Johannes Weiner
Cc: linux-mm, linux-kernel
On 12/08/2015 03:40 PM, Geliang Tang wrote:
> list_to_page() in readahead.c is the same as lru_to_page() in vmscan.c.
> So I move lru_to_page to internal.h and drop list_to_page().
Looks like this would topically fit better to include/linux/mm_inline.h
Vlastimil
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] mm: move lru_to_page to mm_inline.h
2015-12-18 17:25 ` Vlastimil Babka
@ 2015-12-19 9:08 ` Geliang Tang
-1 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2015-12-19 9:08 UTC (permalink / raw)
To: Andrew Morton, Mel Gorman, Vlastimil Babka, Jens Axboe, Tejun Heo
Cc: Geliang Tang, linux-kernel, linux-mm
Move lru_to_page() from internal.h to mm_inline.h.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
include/linux/mm_inline.h | 2 ++
mm/internal.h | 2 --
mm/readahead.c | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index cf55945..712e8c3 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -100,4 +100,6 @@ static __always_inline enum lru_list page_lru(struct page *page)
return lru;
}
+#define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
+
#endif
diff --git a/mm/internal.h b/mm/internal.h
index ca49922..5d8ec89 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -87,8 +87,6 @@ extern int isolate_lru_page(struct page *page);
extern void putback_lru_page(struct page *page);
extern bool zone_reclaimable(struct zone *zone);
-#define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))
-
/*
* in mm/rmap.c:
*/
diff --git a/mm/readahead.c b/mm/readahead.c
index 0aff760..20e58e8 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -17,6 +17,7 @@
#include <linux/pagemap.h>
#include <linux/syscalls.h>
#include <linux/file.h>
+#include <linux/mm_inline.h>
#include "internal.h"
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] mm: move lru_to_page to mm_inline.h
@ 2015-12-19 9:08 ` Geliang Tang
0 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2015-12-19 9:08 UTC (permalink / raw)
To: Andrew Morton, Mel Gorman, Vlastimil Babka, Jens Axboe, Tejun Heo
Cc: Geliang Tang, linux-kernel, linux-mm
Move lru_to_page() from internal.h to mm_inline.h.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
include/linux/mm_inline.h | 2 ++
mm/internal.h | 2 --
mm/readahead.c | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index cf55945..712e8c3 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -100,4 +100,6 @@ static __always_inline enum lru_list page_lru(struct page *page)
return lru;
}
+#define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
+
#endif
diff --git a/mm/internal.h b/mm/internal.h
index ca49922..5d8ec89 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -87,8 +87,6 @@ extern int isolate_lru_page(struct page *page);
extern void putback_lru_page(struct page *page);
extern bool zone_reclaimable(struct zone *zone);
-#define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))
-
/*
* in mm/rmap.c:
*/
diff --git a/mm/readahead.c b/mm/readahead.c
index 0aff760..20e58e8 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -17,6 +17,7 @@
#include <linux/pagemap.h>
#include <linux/syscalls.h>
#include <linux/file.h>
+#include <linux/mm_inline.h>
#include "internal.h"
--
2.5.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: move lru_to_page to mm_inline.h
2015-12-19 9:08 ` Geliang Tang
@ 2015-12-21 10:14 ` Vlastimil Babka
-1 siblings, 0 replies; 7+ messages in thread
From: Vlastimil Babka @ 2015-12-21 10:14 UTC (permalink / raw)
To: Geliang Tang, Andrew Morton, Mel Gorman, Jens Axboe, Tejun Heo
Cc: linux-kernel, linux-mm
On 12/19/2015 10:08 AM, Geliang Tang wrote:
> Move lru_to_page() from internal.h to mm_inline.h.
The file already contains functionality related to lru.
> Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> include/linux/mm_inline.h | 2 ++
> mm/internal.h | 2 --
> mm/readahead.c | 1 +
> 3 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
> index cf55945..712e8c3 100644
> --- a/include/linux/mm_inline.h
> +++ b/include/linux/mm_inline.h
> @@ -100,4 +100,6 @@ static __always_inline enum lru_list page_lru(struct page *page)
> return lru;
> }
>
> +#define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
> +
> #endif
> diff --git a/mm/internal.h b/mm/internal.h
> index ca49922..5d8ec89 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -87,8 +87,6 @@ extern int isolate_lru_page(struct page *page);
> extern void putback_lru_page(struct page *page);
> extern bool zone_reclaimable(struct zone *zone);
>
> -#define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))
> -
> /*
> * in mm/rmap.c:
> */
> diff --git a/mm/readahead.c b/mm/readahead.c
> index 0aff760..20e58e8 100644
> --- a/mm/readahead.c
> +++ b/mm/readahead.c
> @@ -17,6 +17,7 @@
> #include <linux/pagemap.h>
> #include <linux/syscalls.h>
> #include <linux/file.h>
> +#include <linux/mm_inline.h>
>
> #include "internal.h"
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: move lru_to_page to mm_inline.h
@ 2015-12-21 10:14 ` Vlastimil Babka
0 siblings, 0 replies; 7+ messages in thread
From: Vlastimil Babka @ 2015-12-21 10:14 UTC (permalink / raw)
To: Geliang Tang, Andrew Morton, Mel Gorman, Jens Axboe, Tejun Heo
Cc: linux-kernel, linux-mm
On 12/19/2015 10:08 AM, Geliang Tang wrote:
> Move lru_to_page() from internal.h to mm_inline.h.
The file already contains functionality related to lru.
> Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> include/linux/mm_inline.h | 2 ++
> mm/internal.h | 2 --
> mm/readahead.c | 1 +
> 3 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
> index cf55945..712e8c3 100644
> --- a/include/linux/mm_inline.h
> +++ b/include/linux/mm_inline.h
> @@ -100,4 +100,6 @@ static __always_inline enum lru_list page_lru(struct page *page)
> return lru;
> }
>
> +#define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
> +
> #endif
> diff --git a/mm/internal.h b/mm/internal.h
> index ca49922..5d8ec89 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -87,8 +87,6 @@ extern int isolate_lru_page(struct page *page);
> extern void putback_lru_page(struct page *page);
> extern bool zone_reclaimable(struct zone *zone);
>
> -#define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))
> -
> /*
> * in mm/rmap.c:
> */
> diff --git a/mm/readahead.c b/mm/readahead.c
> index 0aff760..20e58e8 100644
> --- a/mm/readahead.c
> +++ b/mm/readahead.c
> @@ -17,6 +17,7 @@
> #include <linux/pagemap.h>
> #include <linux/syscalls.h>
> #include <linux/file.h>
> +#include <linux/mm_inline.h>
>
> #include "internal.h"
>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-12-21 10:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08 14:40 [PATCH] mm/readahead.c, mm/vmscan.c: use lru_to_page instead of list_to_page Geliang Tang
2015-12-18 17:25 ` Vlastimil Babka
2015-12-18 17:25 ` Vlastimil Babka
2015-12-19 9:08 ` [PATCH] mm: move lru_to_page to mm_inline.h Geliang Tang
2015-12-19 9:08 ` Geliang Tang
2015-12-21 10:14 ` Vlastimil Babka
2015-12-21 10:14 ` Vlastimil Babka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.