Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1592338
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] mm: use is_migrate_highatomic() to simplify the code |
| Date | 2017-03-04 00:20 +0100 |
| Message-ID | <th4Ep-8eD-9@gated-at.bofh.it> (permalink) |
| References | <tgTzj-t8-7@gated-at.bofh.it> <tgXMC-3jh-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, 3 Mar 2017 14:18:08 +0100 Michal Hocko <mhocko@kernel.org> wrote:
> On Fri 03-03-17 19:10:13, Xishi Qiu wrote:
> > Introduce two helpers, is_migrate_highatomic() and is_migrate_highatomic_page().
> > Simplify the code, no functional changes.
>
> static inline helpers would be nicer than macros
Always.
We made a big dependency mess in mmzone.h. internal.h works.
--- a/include/linux/mmzone.h~mm-use-is_migrate_highatomic-to-simplify-the-code-fix
+++ a/include/linux/mmzone.h
@@ -35,7 +35,7 @@
*/
#define PAGE_ALLOC_COSTLY_ORDER 3
-enum {
+enum migratetype {
MIGRATE_UNMOVABLE,
MIGRATE_MOVABLE,
MIGRATE_RECLAIMABLE,
@@ -66,11 +66,6 @@ enum {
/* In mm/page_alloc.c; keep in sync also with show_migration_types() there */
extern char * const migratetype_names[MIGRATE_TYPES];
-#define is_migrate_highatomic(migratetype) \
- (migratetype == MIGRATE_HIGHATOMIC)
-#define is_migrate_highatomic_page(_page) \
- (get_pageblock_migratetype(_page) == MIGRATE_HIGHATOMIC)
-
#ifdef CONFIG_CMA
# define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA)
# define is_migrate_cma_page(_page) (get_pageblock_migratetype(_page) == MIGRATE_CMA)
diff -puN mm/page_alloc.c~mm-use-is_migrate_highatomic-to-simplify-the-code-fix mm/page_alloc.c
diff -puN mm/internal.h~mm-use-is_migrate_highatomic-to-simplify-the-code-fix mm/internal.h
--- a/mm/internal.h~mm-use-is_migrate_highatomic-to-simplify-the-code-fix
+++ a/mm/internal.h
@@ -503,4 +503,14 @@ extern const struct trace_print_flags pa
extern const struct trace_print_flags vmaflag_names[];
extern const struct trace_print_flags gfpflag_names[];
+static inline bool is_migrate_highatomic(enum migratetype migratetype)
+{
+ return migratetype == MIGRATE_HIGHATOMIC;
+}
+
+static inline bool is_migrate_highatomic_page(struct page *page)
+{
+ return get_pageblock_migratetype(page) == MIGRATE_HIGHATOMIC;
+}
+
#endif /* __MM_INTERNAL_H */
_
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/2] mm: use is_migrate_highatomic() to simplify the code Xishi Qiu <qiuxishi@huawei.com> - 2017-03-03 12:30 +0100
Re: [PATCH 1/2] mm: use is_migrate_highatomic() to simplify the code Michal Hocko <mhocko@kernel.org> - 2017-03-03 17:00 +0100
Re: [PATCH 1/2] mm: use is_migrate_highatomic() to simplify the code Andrew Morton <akpm@linux-foundation.org> - 2017-03-04 00:20 +0100
Re: [PATCH 1/2] mm: use is_migrate_highatomic() to simplify the code Michal Hocko <mhocko@kernel.org> - 2017-03-06 15:20 +0100
Re: [PATCH 1/2] mm: use is_migrate_highatomic() to simplify the code Andrew Morton <akpm@linux-foundation.org> - 2017-03-06 22:00 +0100
Re: [PATCH 1/2] mm: use is_migrate_highatomic() to simplify the code Michal Hocko <mhocko@kernel.org> - 2017-03-08 16:00 +0100
csiph-web