mm/migrate: Consolidate page allocation helper functions
Subsystems (7)
RFC 1/1 mm/migrate: Consolidate page allocation helper functions
Allocation helper functions for migrate_pages() remmain scattered with similar names making them really confusing. Rename these functions based on the context for the migration and move them all into common migration header. Functionality remains unchanged.
---
- Based on earlier discussion (https://lkml.org/lkml/2018/1/3/128)
- Wondering if we can still further factorize these helpers functions
include/linux/migrate.h | 112 ++++++++++++++++++++++++++++++++++++++++- include/linux/page-isolation.h | 2 - mm/internal.h | 1 - mm/memory-failure.c | 11 +--- mm/memory_hotplug.c | 19 +------ mm/mempolicy.c | 69 +------------------------ mm/migrate.c | 19 +------ mm/page_alloc.c | 2 +- mm/page_isolation.c | 4 -- 9 files changed, 119 insertions(+), 120 deletions(-)
include/linux/migrate.h +111 -1
@@ -3,6 +3,7 @@#define _LINUX_MIGRATE_H#include <linux/mm.h> +#include <linux/rmap.h> #include <linux/mempolicy.h> #include <linux/migrate_mode.h> #include <linux/hugetlb.h>
@@ -31,6 +32,84 @@ enum migrate_reason {/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */ extern char *migrate_reason_names[MR_TYPES ]; +#ifdef CONFIG_MIGRATION +/* +* Allocate a new page for page migration based on vma policy. +* Start by assuming the page is mapped by the same vma as contains @start. +* Search forward from there, if not. N.B., this assumes that the +* list of pages handed to migrate_pages()--which is how we get here-- +* is in virtual address order. +*/ +static inline struct page *new_page_alloc_mbind (struct page *page,unsigned long start) +{ +struct vm_area_struct *vma; +unsigned long uninitialized_var (address ); + + vma =find_vma (current->mm, start); +while (vma) { + address =page_address_in_vma (page, vma); +if (address != -EFAULT ) +break ; + vma = vma->vm_next; + } + +if (PageHuge (page)) { +return alloc_huge_page_vma (page_hstate (compound_head (page)), + vma, address); + }else if (PageTransHuge (page)) { +struct page *thp; + + thp =alloc_hugepage_vma (GFP_TRANSHUGE , vma, address, +HPAGE_PMD_ORDER ); +if (!thp) +return NULL ; +prep_transhuge_page (thp); +return thp; + } +/* +* if !vma, alloc_page_vma() will use task or system default policy +*/ +return alloc_page_vma (GFP_HIGHUSER_MOVABLE | __GFP_RETRY_MAYFAIL, + vma, address); +} + +/* page allocation callback for NUMA node migration */ +static inline struct page *new_page_alloc_syscall (struct page *page,unsigned long node) +{ +if (PageHuge (page)) +return alloc_huge_page_node (page_hstate (compound_head (page)), + node); +else if (PageTransHuge (page)) { +struct page *thp; + + thp =alloc_pages_node (node, + (GFP_TRANSHUGE | __GFP_THISNODE), +HPAGE_PMD_ORDER ); +if (!thp) +return NULL ; +prep_transhuge_page (thp); +return thp; + }else +return __alloc_pages_node (node,GFP_HIGHUSER_MOVABLE | + __GFP_THISNODE,0 ); +} + + +static inline struct page *new_page_alloc_misplaced (struct page *page, +unsigned long data) +{ +int nid = (int ) data; +struct page *newpage; + + newpage =__alloc_pages_node (nid, + (GFP_HIGHUSER_MOVABLE | + __GFP_THISNODE | __GFP_NOMEMALLOC | + __GFP_NORETRY | __GFP_NOWARN) & + ~__GFP_RECLAIM,0 ); + +return newpage; +} +static inline struct page *new_page_nodemask (struct page *page,int preferred_nid,nodemask_t *nodemask) {
@@ -59,7 +138,34 @@ static inline struct page *new_page_nodemask(struct page *page,return new_page; } -#ifdef CONFIG_MIGRATION +static inline struct page *new_page_alloc_failure (struct page *p,unsigned long private) +{ +int nid =page_to_nid (p); + +return new_page_nodemask (p, nid, &node_states[N_MEMORY ]); +} + +/* +* Try to allocate from a different node but reuse this node if there +* are no other online nodes to be used (e.g. we are offlining a part +* of the only existing node). +*/ +static inline struct page *new_page_alloc_hotplug (struct page *page,unsigned long private) +{ +int nid =page_to_nid (page); +nodemask_t nmask = node_states[N_MEMORY ]; + +node_clear (nid, nmask); +if (nodes_empty (nmask)) +node_set (nid, nmask); + +return new_page_nodemask (page, nid, &nmask); +} + +static inline struct page *new_page_alloc_contig (struct page *page,unsigned long private) +{ +return new_page_nodemask (page,numa_node_id (), &node_states[N_MEMORY ]); +}extern void putback_movable_pages (struct list_head *l); extern int migrate_page(struct address_space *mapping,
@@ -81,6 +187,10 @@ extern int migrate_page_move_mapping(struct address_space *mapping, struct buffer_head *head, enum migrate_mode mode, int extra_count);#else +static inline struct page *new_page_alloc_mbind (struct page *page,unsigned long start) +{ +return NULL ; +}static inline void putback_movable_pages (struct list_head *l) {} static inline int migrate_pages(struct list_head *l, new_page_t new,
include/linux/page-isolation.h +0 -2
@@ -63,6 +63,4 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,int test_pages_isolated (unsigned long start_pfn,unsigned long end_pfn,bool skip_hwpoisoned_pages); -struct page *alloc_migrate_target (struct page *page,unsigned long private); -#endif
mm/internal.h +0 -1
@@ -540,5 +540,4 @@ static inline bool is_migrate_highatomic_page(struct page *page) }void setup_zone_pageset (struct zone *zone); -extern struct page *alloc_new_node_page (struct page *page,unsigned long node);#endif /* __MM_INTERNAL_H */
mm/memory-failure.c +2 -9
@@ -1483,13 +1483,6 @@ int unpoison_memory(unsigned long pfn) }EXPORT_SYMBOL (unpoison_memory); -static struct page *new_page (struct page *p,unsigned long private) -{ -int nid =page_to_nid (p); - -return new_page_nodemask (p, nid, &node_states[N_MEMORY ]); -} -/* * Safely get reference count of an arbitrary page. * Returns 0 for a free page, -EIO for a zero refcount page
@@ -1584,7 +1577,7 @@ static int soft_offline_huge_page(struct page *page, int flags)return -EBUSY ; } - ret =migrate_pages (&pagelist, new_page,NULL ,MPOL_MF_MOVE_ALL , + ret =migrate_pages (&pagelist, new_page_alloc_failure,NULL ,MPOL_MF_MOVE_ALL ,MIGRATE_SYNC ,MR_MEMORY_FAILURE );if (ret) { pr_info("soft offline: %#lx: hugepage migration failed %d, type %lx (%pGp)\n",
@@ -1662,7 +1655,7 @@ static int __soft_offline_page(struct page *page, int flags)inc_node_page_state (page,NR_ISOLATED_ANON +page_is_file_cache (page));list_add (&page->lru, &pagelist); - ret =migrate_pages (&pagelist, new_page,NULL ,MPOL_MF_MOVE_ALL , + ret =migrate_pages (&pagelist, new_page_alloc_failure,NULL ,MPOL_MF_MOVE_ALL ,MIGRATE_SYNC ,MR_MEMORY_FAILURE );if (ret) {if (!list_empty (&pagelist))
mm/memory_hotplug.c +1 -18
@@ -1344,23 +1344,6 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end)return 0 ; } -static struct page *new_node_page (struct page *page,unsigned long private) -{ -int nid =page_to_nid (page); -nodemask_t nmask = node_states[N_MEMORY ]; - -/* -* try to allocate from a different node but reuse this node if there -* are no other online nodes to be used (e.g. we are offlining a part -* of the only existing node) -*/ -node_clear (nid, nmask); -if (nodes_empty (nmask)) -node_set (nid, nmask); - -return new_page_nodemask (page, nid, &nmask); -} -#define NR_OFFLINE_AT_ONCE_PAGES (256)static int do_migrate_range (unsigned long start_pfn,unsigned long end_pfn)
@@ -1431,7 +1414,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) }/* Allocate a new page from the nearest neighbor node */ - ret =migrate_pages (&source, new_node_page,NULL ,0 , + ret =migrate_pages (&source, new_page_alloc_hotplug,NULL ,0 ,MIGRATE_SYNC ,MR_MEMORY_HOTPLUG );if (ret)putback_movable_pages (&source);
mm/mempolicy.c +2 -67
99 lines not on this page · raw message
mm/migrate.c +2 -17
@@ -1465,7 +1465,7 @@ static int do_move_pages_to_node(struct mm_struct *mm,if (list_empty (pagelist))return 0 ; - err =migrate_pages (pagelist, alloc_new_node_page,NULL , node, + err =migrate_pages (pagelist, new_page_alloc_syscall,NULL , node,MIGRATE_SYNC ,MR_SYSCALL );if (err)putback_movable_pages (pagelist);
@@ -1796,21 +1796,6 @@ static bool migrate_balanced_pgdat(struct pglist_data *pgdat,return false; } -static struct page *alloc_misplaced_dst_page (struct page *page, -unsigned long data) -{ -int nid = (int ) data; -struct page *newpage; - - newpage =__alloc_pages_node (nid, - (GFP_HIGHUSER_MOVABLE | - __GFP_THISNODE | __GFP_NOMEMALLOC | - __GFP_NORETRY | __GFP_NOWARN) & - ~__GFP_RECLAIM,0 ); - -return newpage; -} -/* * page migration rate limiting control. * Do not migrate more than @pages_to_migrate in a @migrate_interval_millisecs
@@ -1929,7 +1914,7 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, goto out;list_add (&page->lru, &migratepages); - nr_remaining =migrate_pages (&migratepages, alloc_misplaced_dst_page, + nr_remaining =migrate_pages (&migratepages, new_page_alloc_misplaced,NULL , node,MIGRATE_ASYNC ,MR_NUMA_MISPLACED );if (nr_remaining) {
mm/page_alloc.c +1 -1
@@ -7621,7 +7621,7 @@ static int __alloc_contig_migrate_range(struct compact_control *cc, &cc->migratepages); cc->nr_migratepages -= nr_reclaimed; - ret =migrate_pages (&cc->migratepages, alloc_migrate_target, + ret =migrate_pages (&cc->migratepages, new_page_alloc_contig,NULL ,0 , cc->mode,MR_CMA ); }if (ret <0 ) {
mm/page_isolation.c +0 -4
@@ -293,7 +293,3 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn,return pfn < end_pfn ? -EBUSY :0 ; } -struct page *alloc_migrate_target (struct page *page,unsigned long private) -{ -return new_page_nodemask (page,numa_node_id (), &node_states[N_MEMORY ]); -}
Signature · 1 line
2.11.0
Quoted 4 lines · Anshuman Khandual
Allocation helper functions for
migrate_pages()remmain scattered with similar names making them really confusing. Rename these functions based on the context for the migration and move them all into common migration header. Functionality remains unchanged.
OK, I do not rememeber why I was getting header dependecy issues here. Maybe I've just screwed something. So good if we can make most of the callbacks at the single place. It will hopefully prevent from reinventig the weel again. I do not like your renames though. You are making them specific to the caller rather than their semantic.
include/linux/migrate.h enum migrate_reason { · line 43
Quoted 9 lines
include/linux/migrate.h +9
-0+#ifdef CONFIG_MIGRATION +/* +* Allocate a new page for page migration based on vma policy. +* Start by assuming the page is mapped by the same vma as contains @start. +* Search forward from there, if not. N.B., this assumes that the +* list of pages handed to migrate_pages()--which is how we get here-- +* is in virtual address order. +*/ +static inline struct page *new_page_alloc_mbind (struct page *page,unsigned long start)
new_page_alloc_mempolicy or new_page_alloc_vma
Quoted 24 lines
include/linux/migrate.h +24
-0+{ +struct vm_area_struct *vma; +unsigned long uninitialized_var (address ); + + vma =find_vma (current->mm, start); +while (vma) { + address =page_address_in_vma (page, vma); +if (address != -EFAULT ) +break ; + vma = vma->vm_next; + } + +if (PageHuge (page)) { +return alloc_huge_page_vma (page_hstate (compound_head (page)), + vma, address); + }else if (PageTransHuge (page)) { +struct page *thp; + + thp =alloc_hugepage_vma (GFP_TRANSHUGE , vma, address, +HPAGE_PMD_ORDER ); +if (!thp) +return NULL ; +prep_transhuge_page (thp); +return thp;
include/linux/migrate.h enum migrate_reason { · line 77
Quoted 10 lines
include/linux/migrate.h +10
-0+ } +/* +* if !vma, alloc_page_vma() will use task or system default policy +*/ +return alloc_page_vma (GFP_HIGHUSER_MOVABLE | __GFP_RETRY_MAYFAIL, + vma, address); +} + +/* page allocation callback for NUMA node migration */ +static inline struct page *new_page_alloc_syscall (struct page *page,unsigned long node)
new_page_alloc_node. The important thing about this one is that it doesn't fall back to any other node. And the comment should be explicit about that fact.
Quoted 12 lines
include/linux/migrate.h +12
-0+{ +if (PageHuge (page)) +return alloc_huge_page_node (page_hstate (compound_head (page)), + node); +else if (PageTransHuge (page)) { +struct page *thp; + + thp =alloc_pages_node (node, + (GFP_TRANSHUGE | __GFP_THISNODE), +HPAGE_PMD_ORDER ); +if (!thp) +return NULL ;
include/linux/migrate.h enum migrate_reason { · line 99
Quoted 10 lines
include/linux/migrate.h +10
-0+prep_transhuge_page (thp); +return thp; + }else +return __alloc_pages_node (node,GFP_HIGHUSER_MOVABLE | + __GFP_THISNODE,0 ); +} + + +static inline struct page *new_page_alloc_misplaced (struct page *page, +unsigned long data)
This is so special cased that I even wouldn't expose it. Who is going to reuse it?
include/linux/migrate.h enum migrate_reason { · line 108
Quoted 9 lines
include/linux/migrate.h +9
-0+{ +int nid = (int ) data; +struct page *newpage; + + newpage =__alloc_pages_node (nid, + (GFP_HIGHUSER_MOVABLE | + __GFP_THISNODE | __GFP_NOMEMALLOC | + __GFP_NORETRY | __GFP_NOWARN) & + ~__GFP_RECLAIM,0 );
this also deserves one hell of a comment.
include/linux/migrate.h static inline struct page *new_page_nodemask(struct page *page, · line 141
Quoted 13 lines
include/linux/migrate.h +5
-1+ +return newpage; +} +static inline struct page *new_page_nodemask (struct page *page,int preferred_nid,nodemask_t *nodemask) {@@ -59,7 +138,34 @@ static inline struct page *new_page_nodemask(struct page *page,return new_page; } -#ifdef CONFIG_MIGRATION +static inline struct page *new_page_alloc_failure (struct page *p,unsigned long private)
This function in fact allocates arbitrary page with preference of the original page's node. It is by no means specific to HWPoison and _failure in the name is just confusing.
new_page_alloc_keepnode
include/linux/migrate.h static inline struct page *new_page_nodemask(struct page *page, · line 153
Quoted 12 lines
include/linux/migrate.h +12
-0+{ +int nid =page_to_nid (p); + +return new_page_nodemask (p, nid, &node_states[N_MEMORY ]); +} + +/* +* Try to allocate from a different node but reuse this node if there +* are no other online nodes to be used (e.g. we are offlining a part +* of the only existing node). +*/ +static inline struct page *new_page_alloc_hotplug (struct page *page,unsigned long private)
Does anybody ever want to use the same function? We try hard to allocate from any other than original node.
include/linux/migrate.h static inline struct page *new_page_nodemask(struct page *page, · line 165
Quoted 12 lines
include/linux/migrate.h +12
-0+{ +int nid =page_to_nid (page); +nodemask_t nmask = node_states[N_MEMORY ]; + +node_clear (nid, nmask); +if (nodes_empty (nmask)) +node_set (nid, nmask); + +return new_page_nodemask (page, nid, &nmask); +} + +static inline struct page *new_page_alloc_contig (struct page *page,unsigned long private)
What does this name acutally means? Why not simply new_page_alloc? It simply allocates from any node with the local node preference. So basically alloc_pages like.
Quoted 17 lines
include/linux/migrate.h +7
-0+{ +return new_page_nodemask (page,numa_node_id (), &node_states[N_MEMORY ]); +}extern void putback_movable_pages (struct list_head *l); extern int migrate_page(struct address_space *mapping,@@ -81,6 +187,10 @@ extern int migrate_page_move_mapping(struct address_space *mapping, struct buffer_head *head, enum migrate_mode mode, int extra_count);#else +static inline struct page *new_page_alloc_mbind (struct page *page,unsigned long start) +{ +return NULL ; +}static inline void putback_movable_pages (struct list_head *l) {} static inline int migrate_pages(struct list_head *l, new_page_t new,
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · Michal Hocko
Quoted 4 lines · Anshuman Khandual
Allocation helper functions for
migrate_pages()remmain scattered with similar names making them really confusing. Rename these functions based on the context for the migration and move them all into common migration header. Functionality remains unchanged.OK, I do not rememeber why I was getting header dependecy issues here. Maybe I've just screwed something. So good if we can make most of the callbacks at the single place. It will hopefully prevent from reinventig the weel again. I do not like your renames though. You are making them specific to the caller rather than their semantic.
Got it. Actually at first the semantics looked not too trivial to put in a single word at the end in a new_page_[alloc]_* kind of naming.
Quoted 12 lines
include/linux/migrate.h enum migrate_reason { · line 43
Quoted 10 lines
include/linux/migrate.h +9
-0+#ifdef CONFIG_MIGRATION +/* +* Allocate a new page for page migration based on vma policy. +* Start by assuming the page is mapped by the same vma as contains @start. +* Search forward from there, if not. N.B., this assumes that the +* list of pages handed to migrate_pages()--which is how we get here-- +* is in virtual address order. +*/ +static inline struct page *new_page_alloc_mbind (struct page *page,unsigned long start)
new_page_alloc_mempolicyornew_page_alloc_vma
Will rename as new_page_alloc_mempolicy.
Quoted 31 lines
Quoted 31 lines
include/linux/migrate.h +30
-0+{ +struct vm_area_struct *vma; +unsigned long uninitialized_var (address ); + + vma =find_vma (current->mm, start); +while (vma) { + address =page_address_in_vma (page, vma); +if (address != -EFAULT ) +break ; + vma = vma->vm_next; + } + +if (PageHuge (page)) { +return alloc_huge_page_vma (page_hstate (compound_head (page)), + vma, address); + }else if (PageTransHuge (page)) { +struct page *thp; + + thp =alloc_hugepage_vma (GFP_TRANSHUGE , vma, address, +HPAGE_PMD_ORDER ); +if (!thp) +return NULL ; +prep_transhuge_page (thp); +return thp; + } +/* +* if !vma, alloc_page_vma() will use task or system default policy +*/ +return alloc_page_vma (GFP_HIGHUSER_MOVABLE | __GFP_RETRY_MAYFAIL, + vma, address);
Quoted 8 lines
include/linux/migrate.h enum migrate_reason { · line 77
Quoted 4 lines
include/linux/migrate.h +4
-0+} + +/* page allocation callback for NUMA node migration */ +static inline struct page *new_page_alloc_syscall (struct page *page,unsigned long node)
new_page_alloc_node. The important thing about this one is that it doesn't fall back to any other node. And the comment should be explicit about that fact.
Sure, will do.
Quoted 18 lines
Quoted 18 lines
include/linux/migrate.h +17
-0+{ +if (PageHuge (page)) +return alloc_huge_page_node (page_hstate (compound_head (page)), + node); +else if (PageTransHuge (page)) { +struct page *thp; + + thp =alloc_pages_node (node, + (GFP_TRANSHUGE | __GFP_THISNODE), +HPAGE_PMD_ORDER ); +if (!thp) +return NULL ; +prep_transhuge_page (thp); +return thp; + }else +return __alloc_pages_node (node,GFP_HIGHUSER_MOVABLE | + __GFP_THISNODE,0 );
Quoted 8 lines
include/linux/migrate.h enum migrate_reason { · line 99
Quoted 5 lines
include/linux/migrate.h +5
-0+} + + +static inline struct page *new_page_alloc_misplaced (struct page *page, +unsigned long data)This is so special cased that I even wouldn't expose it. Who is going to reuse it?
Yeah this is special cased but the idea to just keep the helper functions in the same place, hence just move this as well.
Quoted 12 lines
include/linux/migrate.h enum migrate_reason { · line 108
Quoted 10 lines
include/linux/migrate.h +9
-0+{ +int nid = (int ) data; +struct page *newpage; + + newpage =__alloc_pages_node (nid, + (GFP_HIGHUSER_MOVABLE | + __GFP_THISNODE | __GFP_NOMEMALLOC | + __GFP_NORETRY | __GFP_NOWARN) & + ~__GFP_RECLAIM,0 );this also deserves one hell of a comment.
Sure, will do.
Quoted 12 lines
Quoted 12 lines
include/linux/migrate.h +4
-0+ +return newpage; +} +static inline struct page *new_page_nodemask (struct page *page,int preferred_nid,nodemask_t *nodemask) {@@ -59,7 +138,34 @@ static inline struct page *new_page_nodemask(struct page *page,return new_page; }
Quoted 8 lines
include/linux/migrate.h static inline struct page *new_page_nodemask(struct page *page, · line 141
Quoted 2 lines
include/linux/migrate.h +1
-1-#ifdef CONFIG_MIGRATION +static inline struct page *new_page_alloc_failure (struct page *p,unsigned long private)This function in fact allocates arbitrary page with preference of the original page's node. It is by no means specific to HWPoison and
_failurein the name is just confusing.
new_page_alloc_keepnode
Sure, will do.
Quoted 16 lines
include/linux/migrate.h static inline struct page *new_page_nodemask(struct page *page, · line 153
Quoted 13 lines
include/linux/migrate.h +12
-0+{ +int nid =page_to_nid (p); + +return new_page_nodemask (p, nid, &node_states[N_MEMORY ]); +} + +/* +* Try to allocate from a different node but reuse this node if there +* are no other online nodes to be used (e.g. we are offlining a part +* of the only existing node). +*/ +static inline struct page *new_page_alloc_hotplug (struct page *page,unsigned long private)Does anybody ever want to use the same function? We try hard to allocate from any other than original node.
Will replace this with new_page_alloc_othernode.
Quoted 8 lines
Quoted 8 lines
include/linux/migrate.h +8
-0+{ +int nid =page_to_nid (page); +nodemask_t nmask = node_states[N_MEMORY ]; + +node_clear (nid, nmask); +if (nodes_empty (nmask)) +node_set (nid, nmask); +
Quoted 8 lines
include/linux/migrate.h static inline struct page *new_page_nodemask(struct page *page, · line 165
Quoted 4 lines
include/linux/migrate.h +4
-0+return new_page_nodemask (page, nid, &nmask); +} + +static inline struct page *new_page_alloc_contig (struct page *page,unsigned long private)What does this name acutally means? Why not simply
new_page_alloc? It simply allocates from any node with the local node preference. So basicallyalloc_pageslike.
I just followed caller based semantics as you have pointed out earlier. Sure, will replace with new_page_alloc().
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Anshuman Khandual
Quoted 5 lines · Michal Hocko
Quoted 4 lines · Anshuman Khandual
Allocation helper functions for
migrate_pages()remmain scattered with similar names making them really confusing. Rename these functions based on the context for the migration and move them all into common migration header. Functionality remains unchanged.
I agree that their names could be made less confusing (though didn't succeed very well when I tried); and maybe a couple of them are general enough to be used from more than one callsite, and could well live in mm/migrate.c.
But moving all of page migration's (currently static) new_page allocator functions away from the code that relies on their special characteristics (probably relayed to them through a private argument), and into a single header file, just seems perverse to me. And likely to be a nuisance when adding more in future: private structures having to be made public just to make them visible in that shared header file.
Would it make sense to keep the various functions that may be called by rmap_walk() together in one rmap_walk.h? The different filesystems' writepage methods together in one writepage.h? I don't think so.
Hugh
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 20 lines · Hugh Dickins
Quoted 6 lines · Anshuman Khandual
Quoted 5 lines · Michal Hocko
Quoted 4 lines · Anshuman Khandual
Allocation helper functions for
migrate_pages()remmain scattered with similar names making them really confusing. Rename these functions based on the context for the migration and move them all into common migration header. Functionality remains unchanged.I agree that their names could be made less confusing (though didn't succeed very well when I tried); and maybe a couple of them are general enough to be used from more than one callsite, and could well live in
mm/migrate.c.But moving all of page migration's (currently static)
new_pageallocator functions away from the code that relies on their special characteristics (probably relayed to them through a private argument), and into a single header file, just seems perverse to me. And likely to be a nuisance when adding more in future: private structures having to be made public just to make them visible in that shared header file.
Quoted 3 lines
Would it make sense to keep the various functions that may be called by
rmap_walk()together in onermap_walk.h? The different filesystems' writepage methods together in onewritepage.h? I don't think so.
Makes sense. Will probably just change the helper names to something more meaningful (from previous suggestions in this thread) next around.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>