From patchwork Fri Jun 9 10:25:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 103460 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp137555qgd; Fri, 9 Jun 2017 03:26:03 -0700 (PDT) X-Received: by 10.84.132.2 with SMTP id 2mr39329520ple.46.1497003963242; Fri, 09 Jun 2017 03:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497003963; cv=none; d=google.com; s=arc-20160816; b=GcXymJCCqir81T6FDiuy+RRIy6EK/kugyzyvNKBDU73M/AqvKxK+wCKRW97NzDvX6O a0Z6WvGpyEBSq1d3+4guDZa9wm+SP1jSdNFVRHDOSOyei/jkYT+25TBSh0TakDRcdMaB 499t31icIb5OeSdBmnFTGR1Av/U+f2KgkbgTTglT1hzxDn0VJinf37QNS6gKeQ/J8t0E /S4GaCLUiLV8hH37pmfbEyL9dTGpSoGVdOdsV0l4ZNuvlYx4p+U4KiZTgXDmIao18yYZ ufwUBdB59rscrl84RBUf8fF5swBLLqirmdi8+w9yWvH7C1+Fung2TqqqLLAqhDCnMcS1 Vezw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ZaxVfmqNxFRI1Tr/mVBltfdzyS+N9JI91czgrJt4YkU=; b=BuWNQoMwwkSUmInDbz368/J7pCCNTq1kZQ99p/vRDAw4GOp7sa7dwyhqfN9rg0w1aa cFjA1d7BF0ArwrJrP/tV2D8jB4YZHppHEzzHvQuxxzHCLz47/iNshhw+qiGJnsO+/Itb tAoAn4J7WMm53qpDHSMLtagzCfPRiu7OfgpP6gVm0SN905ngYoU7DHiTSZl9w/iDpdML jf8rvPNOhRR/uvR3499NLt+s+pKRx1x6mUmlr1QU71VfBa4pP1vqmzKQ4Jp3doErgUb2 xrFtBmhRcxOlKdW4AXXPU3F5295/8m6hpf6MD20gMcsf9thMvbmPFP7M4CjDLyLCtDAI uMcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si6846445pgs.11.2017.06.09.03.26.02; Fri, 09 Jun 2017 03:26:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751728AbdFIK0B (ORCPT + 25 others); Fri, 9 Jun 2017 06:26:01 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:53239 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751563AbdFIKZ7 (ORCPT ); Fri, 9 Jun 2017 06:25:59 -0400 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0LwmZo-1duhL20QMy-016M1Q; Fri, 09 Jun 2017 12:25:48 +0200 From: Arnd Bergmann To: Andrew Morton Cc: Arnd Bergmann , Naoya Horiguchi , "Aneesh Kumar K.V" , Punit Agrawal , Anshuman Khandual , linux-kernel@vger.kernel.org Subject: [PATCH] mm: hugetlb: replace some macros with inline functions Date: Fri, 9 Jun 2017 12:25:05 +0200 Message-Id: <20170609102544.2947326-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:QOTkz2f8hFZKf4gYGmQ6ABFeKGfqKWmxHNny9nAg0Mvj+IHOrWM lELHP7FfDfgVIEvn/OLQIoL6gbGEtAs8bhJjibrmH/LZ1O04I2bclRuOZqJDbRNaA59U2qI GUhonU/DHa2Jpi7pM1uFfcT2Vy+ZYliRyW1GYTxK+pnODcD5YFMr7RYZICFAmc/t4y9wh+8 BSZUiB91+3OAkmb0Rq6/g== X-UI-Out-Filterresults: notjunk:1; V01:K0:amC/Tej7YmQ=:ttsYJtTahU6DoH+td72ePc B0xWaHEE1vRH3V6YtmFSZtgLwh6fTfoItnpVlBM9u8mSasj5Aymm/6RINm6pqDVhUFpVfLBC/ eEuXoYKpSeX3mjMh/jiWV2+VdgXm11tAxM/ZZy+BQYZ7YWU8nNXQRxEK6lVJY1KTB86lMRQpa HzCra4M2m1da+18r15Ii0m2avy0CvYKrXS/otBEtEWTtc88CpGjbBs4cdVEKUxFWUeEaM9XdO LX2SjOVGI3dHgQ3Ud5SEt+Ld1sE81Kw74BVJf/SjCLH59Zhg51Tr2NGJiDnc1oMXWBjvXOsUe T9/UCYUgrjgBF+U6yLp8DA5jxylCxbI8FPmaO9wxXt6c6ttRN3+cxCRLrisY/ecU2uoJzULDJ dJTjzo3UL9htDWIRRV+EzvPssY8uA040zEsvP/04qKUIZ17Q3pI8yqBG6u/623ua/XqkKQZJW d0TMTz73ELYy1B5gVUxryQlhqlI5QcM+PI1qxzkExTEuSIFmF4608f4dmHXIxLexRjXQsWNM2 Cyo+s6C+IiBC7659prTA1KP3vpPWEbdGVIAt6Zwtwbo8IkrS3fBEr59Qw3piwwnxFwlkzP763 8PYY2ajK3MscwS1k1iyaz6jzN3YjhjLwkjN/9Z2N4MwzlTtVdbwhy6TeZGdRY+fcF7FB5JPWJ eC1upg5AVmiQiPv5qnXOm8i6gL+KFM5OgZQyNWEa6hrpa0OSY8X23HkiKeHVTUcKJQf0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- include/linux/hugetlb.h | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) -- 2.9.0 Acked-by: Naoya Horiguchi 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)