Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1662260 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2017-06-09 12:30 +0200 |
| Last post | 2017-06-12 02:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] mm: hugetlb: replace some macros with inline functions Arnd Bergmann <arnd@arndb.de> - 2017-06-09 12:30 +0200
Re: [PATCH] mm: hugetlb: replace some macros with inline functions Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2017-06-12 02:00 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-06-09 12:30 +0200 |
| Subject | [PATCH] mm: hugetlb: replace some macros with inline functions |
| Message-ID | <tQpl0-k7-29@gated-at.bofh.it> |
All users of dissolve_free_huge_page() that ignore the result cause a warning
when CONFIG_HUGETLB_PAGE is disabled:
mm/memory-failure.c: In function 'me_huge_page':
include/linux/hugetlb.h:556:36: error: statement with no effect [-Werror=unused-value]
#define dissolve_free_huge_page(p) 0
We can avoid this by using an inline function instead of the macro, and I
decided to do the same change for the related helpers as well.
Fixes: mmotm ("mm: hugetlb: soft-offline: dissolve source hugepage after successful migration")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
include/linux/hugetlb.h | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index dbb118c566cd..57f700ac127e 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -546,16 +546,37 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)
{
return 1;
}
-#define hstate_index_to_shift(index) 0
-#define hstate_index(h) 0
+
+static inline unsigned hstate_index_to_shift(unsigned index)
+{
+ return 0;
+}
+
+static inline int hstate_index(struct hstate *h)
+{
+ return 0;
+}
static inline pgoff_t basepage_index(struct page *page)
{
return page->index;
}
-#define dissolve_free_huge_page(p) 0
-#define dissolve_free_huge_pages(s, e) 0
-#define hugepage_migration_supported(h) false
+
+static inline int dissolve_free_huge_page(struct page *page)
+{
+ return 0;
+}
+
+static inline int dissolve_free_huge_pages(unsigned long start_pfn,
+ unsigned long end_pfn)
+{
+ return 0;
+}
+
+static inline bool hugepage_migration_supported(struct hstate *h)
+{
+ return false;
+}
static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
struct mm_struct *mm, pte_t *pte)
--
2.9.0
[toc] | [next] | [standalone]
| From | Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> |
|---|---|
| Date | 2017-06-12 02:00 +0200 |
| Message-ID | <tRkVX-2ZS-1@gated-at.bofh.it> |
| In reply to | #1662260 |
On Fri, Jun 09, 2017 at 12:25:05PM +0200, Arnd Bergmann wrote:
> All users of dissolve_free_huge_page() that ignore the result cause a warning
> when CONFIG_HUGETLB_PAGE is disabled:
>
> mm/memory-failure.c: In function 'me_huge_page':
> include/linux/hugetlb.h:556:36: error: statement with no effect [-Werror=unused-value]
> #define dissolve_free_huge_page(p) 0
>
> We can avoid this by using an inline function instead of the macro, and I
> decided to do the same change for the related helpers as well.
>
> Fixes: mmotm ("mm: hugetlb: soft-offline: dissolve source hugepage after successful migration")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Right, thank you for catching this.
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> ---
> include/linux/hugetlb.h | 31 ++++++++++++++++++++++++++-----
> 1 file changed, 26 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index dbb118c566cd..57f700ac127e 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -546,16 +546,37 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)
> {
> return 1;
> }
> -#define hstate_index_to_shift(index) 0
> -#define hstate_index(h) 0
> +
> +static inline unsigned hstate_index_to_shift(unsigned index)
> +{
> + return 0;
> +}
> +
> +static inline int hstate_index(struct hstate *h)
> +{
> + return 0;
> +}
>
> static inline pgoff_t basepage_index(struct page *page)
> {
> return page->index;
> }
> -#define dissolve_free_huge_page(p) 0
> -#define dissolve_free_huge_pages(s, e) 0
> -#define hugepage_migration_supported(h) false
> +
> +static inline int dissolve_free_huge_page(struct page *page)
> +{
> + return 0;
> +}
> +
> +static inline int dissolve_free_huge_pages(unsigned long start_pfn,
> + unsigned long end_pfn)
> +{
> + return 0;
> +}
> +
> +static inline bool hugepage_migration_supported(struct hstate *h)
> +{
> + return false;
> +}
>
> static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
> struct mm_struct *mm, pte_t *pte)
> --
> 2.9.0
>
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web