From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by kanga.kvack.org (Postfix) with ESMTP id 235DB6B0253 for ; Mon, 16 Nov 2015 01:52:37 -0500 (EST) Received: by obdgf3 with SMTP id gf3so115895295obd.3 for ; Sun, 15 Nov 2015 22:52:37 -0800 (PST) Received: from cmccmta3.chinamobile.com (cmccmta3.chinamobile.com. [221.176.66.81]) by mx.google.com with ESMTP id a7si9134130oih.138.2015.11.15.22.52.35 for ; Sun, 15 Nov 2015 22:52:36 -0800 (PST) From: Yaowei Bai Subject: [PATCH 0/7] some small improvement Date: Mon, 16 Nov 2015 14:51:19 +0800 Message-Id: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org Cc: bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org This patchset only performs some small improvement to mm. First, make several functions return bool to improve readability, and then remove unused is_unevictable_lru function and refactor memmap_valid_within for simplicity. No functional change. Yaowei Bai (7): ipc/shm: is_file_shm_hugepages can be boolean mm/hugetlb: is_file_hugepages can be boolean mm/memblock: memblock_is_memory/reserved can be boolean mm/vmscan: page_is_file_cache can be boolean mm/lru: remove unused is_unevictable_lru function mm/gfp: make gfp_zonelist return directly and bool mm/mmzone: refactor memmap_valid_within include/linux/gfp.h | 7 ++----- include/linux/hugetlb.h | 10 ++++------ include/linux/memblock.h | 4 ++-- include/linux/mm_inline.h | 6 +++--- include/linux/mmzone.h | 11 +++-------- include/linux/shm.h | 6 +++--- ipc/shm.c | 2 +- mm/memblock.c | 4 ++-- mm/mmzone.c | 10 ++-------- 9 files changed, 22 insertions(+), 38 deletions(-) -- 1.9.1 -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by kanga.kvack.org (Postfix) with ESMTP id 822E36B0254 for ; Mon, 16 Nov 2015 01:52:39 -0500 (EST) Received: by pabfh17 with SMTP id fh17so167713128pab.0 for ; Sun, 15 Nov 2015 22:52:39 -0800 (PST) Received: from cmccmta1.chinamobile.com (cmccmta1.chinamobile.com. [221.176.66.79]) by mx.google.com with ESMTP id qk3si48249537pac.28.2015.11.15.22.52.37 for ; Sun, 15 Nov 2015 22:52:38 -0800 (PST) From: Yaowei Bai Subject: [PATCH 1/7] ipc/shm: is_file_shm_hugepages can be boolean Date: Mon, 16 Nov 2015 14:51:20 +0800 Message-Id: <1447656686-4851-2-git-send-email-baiyaowei@cmss.chinamobile.com> In-Reply-To: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org Cc: bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org This patch makes is_file_shm_hugepages return bool to improve readability due to this particular function only using either one or zero as its return value. No functional change. Signed-off-by: Yaowei Bai --- include/linux/shm.h | 6 +++--- ipc/shm.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/shm.h b/include/linux/shm.h index 6fb8016..04e8818 100644 --- a/include/linux/shm.h +++ b/include/linux/shm.h @@ -52,7 +52,7 @@ struct sysv_shm { long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, unsigned long shmlba); -int is_file_shm_hugepages(struct file *file); +bool is_file_shm_hugepages(struct file *file); void exit_shm(struct task_struct *task); #define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist) #else @@ -66,9 +66,9 @@ static inline long do_shmat(int shmid, char __user *shmaddr, { return -ENOSYS; } -static inline int is_file_shm_hugepages(struct file *file) +static inline bool is_file_shm_hugepages(struct file *file) { - return 0; + return false; } static inline void exit_shm(struct task_struct *task) { diff --git a/ipc/shm.c b/ipc/shm.c index 4178727..ed3027d 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -459,7 +459,7 @@ static const struct file_operations shm_file_operations_huge = { .fallocate = shm_fallocate, }; -int is_file_shm_hugepages(struct file *file) +bool is_file_shm_hugepages(struct file *file) { return file->f_op == &shm_file_operations_huge; } -- 1.9.1 -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by kanga.kvack.org (Postfix) with ESMTP id D77B16B0255 for ; Mon, 16 Nov 2015 01:52:42 -0500 (EST) Received: by pabfh17 with SMTP id fh17so167714687pab.0 for ; Sun, 15 Nov 2015 22:52:42 -0800 (PST) Received: from cmccmta1.chinamobile.com (cmccmta1.chinamobile.com. [221.176.66.79]) by mx.google.com with ESMTP id rz10si48246183pab.205.2015.11.15.22.52.40 for ; Sun, 15 Nov 2015 22:52:42 -0800 (PST) From: Yaowei Bai Subject: [PATCH 3/7] mm/memblock: memblock_is_memory/reserved can be boolean Date: Mon, 16 Nov 2015 14:51:22 +0800 Message-Id: <1447656686-4851-4-git-send-email-baiyaowei@cmss.chinamobile.com> In-Reply-To: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org Cc: bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org This patch makes memblock_is_memory/reserved return bool to improve readability due to this particular function only using either one or zero as its return value. No functional change. Signed-off-by: Yaowei Bai --- include/linux/memblock.h | 4 ++-- mm/memblock.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 24daf8f..a25cce94 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -318,9 +318,9 @@ phys_addr_t memblock_mem_size(unsigned long limit_pfn); phys_addr_t memblock_start_of_DRAM(void); phys_addr_t memblock_end_of_DRAM(void); void memblock_enforce_memory_limit(phys_addr_t memory_limit); -int memblock_is_memory(phys_addr_t addr); +bool memblock_is_memory(phys_addr_t addr); int memblock_is_region_memory(phys_addr_t base, phys_addr_t size); -int memblock_is_reserved(phys_addr_t addr); +bool memblock_is_reserved(phys_addr_t addr); bool memblock_is_region_reserved(phys_addr_t base, phys_addr_t size); extern void __memblock_dump_all(void); diff --git a/mm/memblock.c b/mm/memblock.c index d300f13..1ab7b9e 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1509,12 +1509,12 @@ static int __init_memblock memblock_search(struct memblock_type *type, phys_addr return -1; } -int __init memblock_is_reserved(phys_addr_t addr) +bool __init memblock_is_reserved(phys_addr_t addr) { return memblock_search(&memblock.reserved, addr) != -1; } -int __init_memblock memblock_is_memory(phys_addr_t addr) +bool __init_memblock memblock_is_memory(phys_addr_t addr) { return memblock_search(&memblock.memory, addr) != -1; } -- 1.9.1 -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by kanga.kvack.org (Postfix) with ESMTP id A6D316B0256 for ; Mon, 16 Nov 2015 01:52:43 -0500 (EST) Received: by obbww6 with SMTP id ww6so115123039obb.0 for ; Sun, 15 Nov 2015 22:52:43 -0800 (PST) Received: from cmccmta1.chinamobile.com (cmccmta1.chinamobile.com. [221.176.66.79]) by mx.google.com with ESMTP id z8si19975527obk.95.2015.11.15.22.52.42 for ; Sun, 15 Nov 2015 22:52:42 -0800 (PST) From: Yaowei Bai Subject: [PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean Date: Mon, 16 Nov 2015 14:51:23 +0800 Message-Id: <1447656686-4851-5-git-send-email-baiyaowei@cmss.chinamobile.com> In-Reply-To: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org Cc: bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org This patch makes page_is_file_cache return bool to improve readability due to this particular function only using either one or zero as its return value. No functional change. Signed-off-by: Yaowei Bai --- include/linux/mm_inline.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index cf55945..af73135 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -8,8 +8,8 @@ * page_is_file_cache - should the page be on a file LRU or anon LRU? * @page: the page to test * - * Returns 1 if @page is page cache page backed by a regular filesystem, - * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. + * Returns true if @page is page cache page backed by a regular filesystem, + * or false if @page is anonymous, tmpfs or otherwise ram or swap backed. * Used by functions that manipulate the LRU lists, to sort a page * onto the right LRU list. * @@ -17,7 +17,7 @@ * needs to survive until the page is last deleted from the LRU, which * could be as far down as __page_cache_release. */ -static inline int page_is_file_cache(struct page *page) +static inline bool page_is_file_cache(struct page *page) { return !PageSwapBacked(page); } -- 1.9.1 -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by kanga.kvack.org (Postfix) with ESMTP id 4C7606B0257 for ; Mon, 16 Nov 2015 01:52:45 -0500 (EST) Received: by oies6 with SMTP id s6so79594639oie.1 for ; Sun, 15 Nov 2015 22:52:45 -0800 (PST) Received: from cmccmta3.chinamobile.com (cmccmta3.chinamobile.com. [221.176.66.81]) by mx.google.com with ESMTP id sx2si15187236oeb.21.2015.11.15.22.52.43 for ; Sun, 15 Nov 2015 22:52:44 -0800 (PST) From: Yaowei Bai Subject: [PATCH 5/7] mm/lru: remove unused is_unevictable_lru function Date: Mon, 16 Nov 2015 14:51:24 +0800 Message-Id: <1447656686-4851-6-git-send-email-baiyaowei@cmss.chinamobile.com> In-Reply-To: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org Cc: bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Since commit a0b8cab3 ("mm: remove lru parameter from __pagevec_lru_add and remove parts of pagevec API") there's no user of this function anymore, so remove it. Signed-off-by: Yaowei Bai --- include/linux/mmzone.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index e23a9e7..9963846 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -195,11 +195,6 @@ static inline int is_active_lru(enum lru_list lru) return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE); } -static inline int is_unevictable_lru(enum lru_list lru) -{ - return (lru == LRU_UNEVICTABLE); -} - struct zone_reclaim_stat { /* * The pageout code in vmscan.c keeps track of how many of the -- 1.9.1 -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by kanga.kvack.org (Postfix) with ESMTP id E6C5E6B0258 for ; Mon, 16 Nov 2015 01:52:46 -0500 (EST) Received: by padhx2 with SMTP id hx2so165579389pad.1 for ; Sun, 15 Nov 2015 22:52:46 -0800 (PST) Received: from cmccmta2.chinamobile.com (cmccmta2.chinamobile.com. [221.176.66.80]) by mx.google.com with ESMTP id fy6si17666349pbd.163.2015.11.15.22.52.45 for ; Sun, 15 Nov 2015 22:52:46 -0800 (PST) From: Yaowei Bai Subject: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool Date: Mon, 16 Nov 2015 14:51:25 +0800 Message-Id: <1447656686-4851-7-git-send-email-baiyaowei@cmss.chinamobile.com> In-Reply-To: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org Cc: bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org This patch makes gfp_zonelist return bool due to this particular function only using either one or zero as its return value. This patch also makes gfp_zonelist return directly by removing if. No functional change. Signed-off-by: Yaowei Bai --- include/linux/gfp.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 6523109..1da03f5 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -375,12 +375,9 @@ static inline enum zone_type gfp_zone(gfp_t flags) * virtual kernel addresses to the allocated page(s). */ -static inline int gfp_zonelist(gfp_t flags) +static inline bool gfp_zonelist(gfp_t flags) { - if (IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE)) - return 1; - - return 0; + return IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE); } /* -- 1.9.1 -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by kanga.kvack.org (Postfix) with ESMTP id 990C46B0259 for ; Mon, 16 Nov 2015 01:52:48 -0500 (EST) Received: by pacdm15 with SMTP id dm15so165458619pac.3 for ; Sun, 15 Nov 2015 22:52:48 -0800 (PST) Received: from cmccmta3.chinamobile.com (cmccmta3.chinamobile.com. [221.176.66.81]) by mx.google.com with ESMTP id pp8si48586726pbc.2.2015.11.15.22.52.46 for ; Sun, 15 Nov 2015 22:52:47 -0800 (PST) From: Yaowei Bai Subject: [PATCH 7/7] mm/mmzone: refactor memmap_valid_within Date: Mon, 16 Nov 2015 14:51:26 +0800 Message-Id: <1447656686-4851-8-git-send-email-baiyaowei@cmss.chinamobile.com> In-Reply-To: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org Cc: bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org This patch makes memmap_valid_within return bool due to this particular function only using either one or zero as its return value. This patch also refactors memmap_valid_within for simplicity. No functional change. Signed-off-by: Yaowei Bai --- include/linux/mmzone.h | 6 +++--- mm/mmzone.c | 10 ++-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 9963846..b9b59bb8 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1202,13 +1202,13 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long); * the zone and PFN linkages are still valid. This is expensive, but walkers * of the full memmap are extremely rare. */ -int memmap_valid_within(unsigned long pfn, +bool memmap_valid_within(unsigned long pfn, struct page *page, struct zone *zone); #else -static inline int memmap_valid_within(unsigned long pfn, +static inline bool memmap_valid_within(unsigned long pfn, struct page *page, struct zone *zone) { - return 1; + return true; } #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ diff --git a/mm/mmzone.c b/mm/mmzone.c index 7d87ebb..de0824e 100644 --- a/mm/mmzone.c +++ b/mm/mmzone.c @@ -72,16 +72,10 @@ struct zoneref *next_zones_zonelist(struct zoneref *z, } #ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL -int memmap_valid_within(unsigned long pfn, +bool memmap_valid_within(unsigned long pfn, struct page *page, struct zone *zone) { - if (page_to_pfn(page) != pfn) - return 0; - - if (page_zone(page) != zone) - return 0; - - return 1; + return page_to_pfn(page) == pfn && page_zone(page) == zone; } #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ -- 1.9.1 -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by kanga.kvack.org (Postfix) with ESMTP id 888F26B025A for ; Mon, 16 Nov 2015 01:53:07 -0500 (EST) Received: by padhx2 with SMTP id hx2so165588906pad.1 for ; Sun, 15 Nov 2015 22:53:07 -0800 (PST) Received: from cmccmta3.chinamobile.com (cmccmta3.chinamobile.com. [221.176.66.81]) by mx.google.com with ESMTP id ry4si353404pac.153.2015.11.15.22.52.38 for ; Sun, 15 Nov 2015 22:53:06 -0800 (PST) From: Yaowei Bai Subject: [PATCH 2/7] mm/hugetlb: is_file_hugepages can be boolean Date: Mon, 16 Nov 2015 14:51:21 +0800 Message-Id: <1447656686-4851-3-git-send-email-baiyaowei@cmss.chinamobile.com> In-Reply-To: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org Cc: bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org This patch makes is_file_hugepages return bool to improve readability due to this particular function only using either one or zero as its return value. This patch also removed the if condition to make is_file_hugepages return directly. No functional change. Signed-off-by: Yaowei Bai --- include/linux/hugetlb.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 685c262..204c7f5 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -265,20 +265,18 @@ struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct, struct user_struct **user, int creat_flags, int page_size_log); -static inline int is_file_hugepages(struct file *file) +static inline bool is_file_hugepages(struct file *file) { if (file->f_op == &hugetlbfs_file_operations) - return 1; - if (is_file_shm_hugepages(file)) - return 1; + return true; - return 0; + return is_file_shm_hugepages(file); } #else /* !CONFIG_HUGETLBFS */ -#define is_file_hugepages(file) 0 +#define is_file_hugepages(file) false static inline struct file * hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, struct user_struct **user, int creat_flags, -- 1.9.1 -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by kanga.kvack.org (Postfix) with ESMTP id 427436B0253 for ; Mon, 16 Nov 2015 05:05:50 -0500 (EST) Received: by pacdm15 with SMTP id dm15so170720080pac.3 for ; Mon, 16 Nov 2015 02:05:50 -0800 (PST) Received: from mail-pa0-x229.google.com (mail-pa0-x229.google.com. [2607:f8b0:400e:c03::229]) by mx.google.com with ESMTPS id zx6si49596877pbc.51.2015.11.16.02.05.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2015 02:05:49 -0800 (PST) Received: by pacej9 with SMTP id ej9so64064401pac.2 for ; Mon, 16 Nov 2015 02:05:49 -0800 (PST) Date: Mon, 16 Nov 2015 02:05:46 -0800 (PST) From: David Rientjes Subject: Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool In-Reply-To: <1447656686-4851-7-git-send-email-baiyaowei@cmss.chinamobile.com> Message-ID: References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-7-git-send-email-baiyaowei@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Yaowei Bai Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon, 16 Nov 2015, Yaowei Bai wrote: > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > index 6523109..1da03f5 100644 > --- a/include/linux/gfp.h > +++ b/include/linux/gfp.h > @@ -375,12 +375,9 @@ static inline enum zone_type gfp_zone(gfp_t flags) > * virtual kernel addresses to the allocated page(s). > */ > > -static inline int gfp_zonelist(gfp_t flags) > +static inline bool gfp_zonelist(gfp_t flags) > { > - if (IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE)) > - return 1; > - > - return 0; > + return IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE); > } > > /* This function is used to index into a pgdat's node_zonelists[] array, bool makes no sense. -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by kanga.kvack.org (Postfix) with ESMTP id 347B66B0254 for ; Mon, 16 Nov 2015 05:10:13 -0500 (EST) Received: by pabfh17 with SMTP id fh17so173306003pab.0 for ; Mon, 16 Nov 2015 02:10:13 -0800 (PST) Received: from mail-pa0-x234.google.com (mail-pa0-x234.google.com. [2607:f8b0:400e:c03::234]) by mx.google.com with ESMTPS id rw4si49323043pab.147.2015.11.16.02.10.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2015 02:10:12 -0800 (PST) Received: by pabfh17 with SMTP id fh17so173305786pab.0 for ; Mon, 16 Nov 2015 02:10:12 -0800 (PST) Date: Mon, 16 Nov 2015 02:10:10 -0800 (PST) From: David Rientjes Subject: Re: [PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean In-Reply-To: <1447656686-4851-5-git-send-email-baiyaowei@cmss.chinamobile.com> Message-ID: References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-5-git-send-email-baiyaowei@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Yaowei Bai Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon, 16 Nov 2015, Yaowei Bai wrote: > diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h > index cf55945..af73135 100644 > --- a/include/linux/mm_inline.h > +++ b/include/linux/mm_inline.h > @@ -8,8 +8,8 @@ > * page_is_file_cache - should the page be on a file LRU or anon LRU? > * @page: the page to test > * > - * Returns 1 if @page is page cache page backed by a regular filesystem, > - * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. > + * Returns true if @page is page cache page backed by a regular filesystem, > + * or false if @page is anonymous, tmpfs or otherwise ram or swap backed. > * Used by functions that manipulate the LRU lists, to sort a page > * onto the right LRU list. > * > @@ -17,7 +17,7 @@ > * needs to survive until the page is last deleted from the LRU, which > * could be as far down as __page_cache_release. > */ > -static inline int page_is_file_cache(struct page *page) > +static inline bool page_is_file_cache(struct page *page) > { > return !PageSwapBacked(page); > } Since page_is_file_cache() is often used to determine which zlc to increment or decrement (usage such as NR_ISOLATED_ANON + page_is_file_cache(page)), I don't think this style is helpful. -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by kanga.kvack.org (Postfix) with ESMTP id 912156B0253 for ; Mon, 16 Nov 2015 07:39:30 -0500 (EST) Received: by wmdw130 with SMTP id w130so109092061wmd.0 for ; Mon, 16 Nov 2015 04:39:30 -0800 (PST) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com. [74.125.82.68]) by mx.google.com with ESMTPS id 12si25425107wmg.120.2015.11.16.04.39.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2015 04:39:29 -0800 (PST) Received: by wmuu63 with SMTP id u63so25614306wmu.0 for ; Mon, 16 Nov 2015 04:39:29 -0800 (PST) Date: Mon, 16 Nov 2015 13:39:27 +0100 From: Michal Hocko Subject: Re: [PATCH 1/7] ipc/shm: is_file_shm_hugepages can be boolean Message-ID: <20151116123927.GB14116@dhcp22.suse.cz> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-2-git-send-email-baiyaowei@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447656686-4851-2-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: Yaowei Bai Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon 16-11-15 14:51:20, Yaowei Bai wrote: > This patch makes is_file_shm_hugepages return bool to improve > readability due to this particular function only using either > one or zero as its return value. yes it makes sense here. > No functional change. > > Signed-off-by: Yaowei Bai Acked-by: Michal Hocko > --- > include/linux/shm.h | 6 +++--- > ipc/shm.c | 2 +- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/linux/shm.h b/include/linux/shm.h > index 6fb8016..04e8818 100644 > --- a/include/linux/shm.h > +++ b/include/linux/shm.h > @@ -52,7 +52,7 @@ struct sysv_shm { > > long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, > unsigned long shmlba); > -int is_file_shm_hugepages(struct file *file); > +bool is_file_shm_hugepages(struct file *file); > void exit_shm(struct task_struct *task); > #define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist) > #else > @@ -66,9 +66,9 @@ static inline long do_shmat(int shmid, char __user *shmaddr, > { > return -ENOSYS; > } > -static inline int is_file_shm_hugepages(struct file *file) > +static inline bool is_file_shm_hugepages(struct file *file) > { > - return 0; > + return false; > } > static inline void exit_shm(struct task_struct *task) > { > diff --git a/ipc/shm.c b/ipc/shm.c > index 4178727..ed3027d 100644 > --- a/ipc/shm.c > +++ b/ipc/shm.c > @@ -459,7 +459,7 @@ static const struct file_operations shm_file_operations_huge = { > .fallocate = shm_fallocate, > }; > > -int is_file_shm_hugepages(struct file *file) > +bool is_file_shm_hugepages(struct file *file) > { > return file->f_op == &shm_file_operations_huge; > } > -- > 1.9.1 > > -- Michal Hocko SUSE Labs -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by kanga.kvack.org (Postfix) with ESMTP id 6E9D66B0254 for ; Mon, 16 Nov 2015 07:40:46 -0500 (EST) Received: by wmww144 with SMTP id w144so117208593wmw.0 for ; Mon, 16 Nov 2015 04:40:46 -0800 (PST) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com. [74.125.82.66]) by mx.google.com with ESMTPS id y198si25442056wmd.101.2015.11.16.04.40.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2015 04:40:45 -0800 (PST) Received: by wmuu63 with SMTP id u63so25623779wmu.0 for ; Mon, 16 Nov 2015 04:40:45 -0800 (PST) Date: Mon, 16 Nov 2015 13:40:44 +0100 From: Michal Hocko Subject: Re: [PATCH 2/7] mm/hugetlb: is_file_hugepages can be boolean Message-ID: <20151116124043.GC14116@dhcp22.suse.cz> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-3-git-send-email-baiyaowei@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447656686-4851-3-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: Yaowei Bai Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon 16-11-15 14:51:21, Yaowei Bai wrote: > This patch makes is_file_hugepages return bool to improve > readability due to this particular function only using either > one or zero as its return value. > > This patch also removed the if condition to make is_file_hugepages > return directly. > > No functional change. > > Signed-off-by: Yaowei Bai I think this could be squashed into the previous patch. Acked-by: Michal Hocko > --- > include/linux/hugetlb.h | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > index 685c262..204c7f5 100644 > --- a/include/linux/hugetlb.h > +++ b/include/linux/hugetlb.h > @@ -265,20 +265,18 @@ struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct, > struct user_struct **user, int creat_flags, > int page_size_log); > > -static inline int is_file_hugepages(struct file *file) > +static inline bool is_file_hugepages(struct file *file) > { > if (file->f_op == &hugetlbfs_file_operations) > - return 1; > - if (is_file_shm_hugepages(file)) > - return 1; > + return true; > > - return 0; > + return is_file_shm_hugepages(file); > } > > > #else /* !CONFIG_HUGETLBFS */ > > -#define is_file_hugepages(file) 0 > +#define is_file_hugepages(file) false > static inline struct file * > hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, > struct user_struct **user, int creat_flags, > -- > 1.9.1 > > -- Michal Hocko SUSE Labs -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by kanga.kvack.org (Postfix) with ESMTP id 45F566B0253 for ; Mon, 16 Nov 2015 07:41:53 -0500 (EST) Received: by wmvv187 with SMTP id v187so174212514wmv.1 for ; Mon, 16 Nov 2015 04:41:52 -0800 (PST) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com. [74.125.82.66]) by mx.google.com with ESMTPS id u185si25496759wmu.20.2015.11.16.04.41.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2015 04:41:52 -0800 (PST) Received: by wmec201 with SMTP id c201so25635497wme.3 for ; Mon, 16 Nov 2015 04:41:51 -0800 (PST) Date: Mon, 16 Nov 2015 13:41:50 +0100 From: Michal Hocko Subject: Re: [PATCH 3/7] mm/memblock: memblock_is_memory/reserved can be boolean Message-ID: <20151116124150.GD14116@dhcp22.suse.cz> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-4-git-send-email-baiyaowei@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447656686-4851-4-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: Yaowei Bai Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon 16-11-15 14:51:22, Yaowei Bai wrote: > This patch makes memblock_is_memory/reserved return bool to improve > readability due to this particular function only using either > one or zero as its return value. > > No functional change. > > Signed-off-by: Yaowei Bai Acked-by: Michal Hocko > --- > include/linux/memblock.h | 4 ++-- > mm/memblock.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/linux/memblock.h b/include/linux/memblock.h > index 24daf8f..a25cce94 100644 > --- a/include/linux/memblock.h > +++ b/include/linux/memblock.h > @@ -318,9 +318,9 @@ phys_addr_t memblock_mem_size(unsigned long limit_pfn); > phys_addr_t memblock_start_of_DRAM(void); > phys_addr_t memblock_end_of_DRAM(void); > void memblock_enforce_memory_limit(phys_addr_t memory_limit); > -int memblock_is_memory(phys_addr_t addr); > +bool memblock_is_memory(phys_addr_t addr); > int memblock_is_region_memory(phys_addr_t base, phys_addr_t size); > -int memblock_is_reserved(phys_addr_t addr); > +bool memblock_is_reserved(phys_addr_t addr); > bool memblock_is_region_reserved(phys_addr_t base, phys_addr_t size); > > extern void __memblock_dump_all(void); > diff --git a/mm/memblock.c b/mm/memblock.c > index d300f13..1ab7b9e 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -1509,12 +1509,12 @@ static int __init_memblock memblock_search(struct memblock_type *type, phys_addr > return -1; > } > > -int __init memblock_is_reserved(phys_addr_t addr) > +bool __init memblock_is_reserved(phys_addr_t addr) > { > return memblock_search(&memblock.reserved, addr) != -1; > } > > -int __init_memblock memblock_is_memory(phys_addr_t addr) > +bool __init_memblock memblock_is_memory(phys_addr_t addr) > { > return memblock_search(&memblock.memory, addr) != -1; > } > -- > 1.9.1 > > -- Michal Hocko SUSE Labs -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by kanga.kvack.org (Postfix) with ESMTP id 567EF6B0254 for ; Mon, 16 Nov 2015 07:43:09 -0500 (EST) Received: by wmvv187 with SMTP id v187so174266999wmv.1 for ; Mon, 16 Nov 2015 04:43:09 -0800 (PST) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com. [74.125.82.67]) by mx.google.com with ESMTPS id 63si25410953wmx.10.2015.11.16.04.43.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2015 04:43:08 -0800 (PST) Received: by wmuu63 with SMTP id u63so25641355wmu.0 for ; Mon, 16 Nov 2015 04:43:08 -0800 (PST) Date: Mon, 16 Nov 2015 13:43:07 +0100 From: Michal Hocko Subject: Re: [PATCH 5/7] mm/lru: remove unused is_unevictable_lru function Message-ID: <20151116124307.GE14116@dhcp22.suse.cz> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-6-git-send-email-baiyaowei@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447656686-4851-6-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: Yaowei Bai Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon 16-11-15 14:51:24, Yaowei Bai wrote: > Since commit a0b8cab3 ("mm: remove lru parameter from __pagevec_lru_add > and remove parts of pagevec API") there's no user of this function anymore, > so remove it. > > Signed-off-by: Yaowei Bai Acked-by: Michal Hocko > --- > include/linux/mmzone.h | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > index e23a9e7..9963846 100644 > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -195,11 +195,6 @@ static inline int is_active_lru(enum lru_list lru) > return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE); > } > > -static inline int is_unevictable_lru(enum lru_list lru) > -{ > - return (lru == LRU_UNEVICTABLE); > -} > - > struct zone_reclaim_stat { > /* > * The pageout code in vmscan.c keeps track of how many of the > -- > 1.9.1 > > -- Michal Hocko SUSE Labs -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by kanga.kvack.org (Postfix) with ESMTP id 9D9EA6B0253 for ; Mon, 16 Nov 2015 07:45:03 -0500 (EST) Received: by wmvv187 with SMTP id v187so174348162wmv.1 for ; Mon, 16 Nov 2015 04:45:03 -0800 (PST) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com. [74.125.82.68]) by mx.google.com with ESMTPS id q20si43353156wjw.68.2015.11.16.04.45.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2015 04:45:02 -0800 (PST) Received: by wmuu63 with SMTP id u63so25655501wmu.0 for ; Mon, 16 Nov 2015 04:45:02 -0800 (PST) Date: Mon, 16 Nov 2015 13:45:01 +0100 From: Michal Hocko Subject: Re: [PATCH 7/7] mm/mmzone: refactor memmap_valid_within Message-ID: <20151116124501.GF14116@dhcp22.suse.cz> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-8-git-send-email-baiyaowei@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447656686-4851-8-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: Yaowei Bai Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon 16-11-15 14:51:26, Yaowei Bai wrote: [...] > @@ -72,16 +72,10 @@ struct zoneref *next_zones_zonelist(struct zoneref *z, > } > > #ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL > -int memmap_valid_within(unsigned long pfn, > +bool memmap_valid_within(unsigned long pfn, > struct page *page, struct zone *zone) > { > - if (page_to_pfn(page) != pfn) > - return 0; > - > - if (page_zone(page) != zone) > - return 0; > - > - return 1; > + return page_to_pfn(page) == pfn && page_zone(page) == zone; I do not think this is easier to read. Quite contrary > } > #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ > > -- > 1.9.1 > > -- Michal Hocko SUSE Labs -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by kanga.kvack.org (Postfix) with ESMTP id 41CFA6B0038 for ; Mon, 16 Nov 2015 21:01:27 -0500 (EST) Received: by padhx2 with SMTP id hx2so193867334pad.1 for ; Mon, 16 Nov 2015 18:01:27 -0800 (PST) Received: from cmccmta3.chinamobile.com (cmccmta3.chinamobile.com. [221.176.66.81]) by mx.google.com with ESMTP id v17si54359660pbs.10.2015.11.16.18.01.25 for ; Mon, 16 Nov 2015 18:01:26 -0800 (PST) Date: Tue, 17 Nov 2015 09:59:50 +0800 From: Yaowei Bai Subject: Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool Message-ID: <20151117015950.GA5867@yaowei-K42JY> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-7-git-send-email-baiyaowei@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: David Rientjes Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon, Nov 16, 2015 at 02:05:46AM -0800, David Rientjes wrote: > On Mon, 16 Nov 2015, Yaowei Bai wrote: > > > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > > index 6523109..1da03f5 100644 > > --- a/include/linux/gfp.h > > +++ b/include/linux/gfp.h > > @@ -375,12 +375,9 @@ static inline enum zone_type gfp_zone(gfp_t flags) > > * virtual kernel addresses to the allocated page(s). > > */ > > > > -static inline int gfp_zonelist(gfp_t flags) > > +static inline bool gfp_zonelist(gfp_t flags) > > { > > - if (IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE)) > > - return 1; > > - > > - return 0; > > + return IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE); > > } > > > > /* > > This function is used to index into a pgdat's node_zonelists[] array, bool > makes no sense. Yes, you'r right, but i think hardcoding the index here is not a good idea. How about this: diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 6523109..14a6249 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -378,9 +378,9 @@ static inline enum zone_type gfp_zone(gfp_t flags) static inline int gfp_zonelist(gfp_t flags) { if (IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE)) - return 1; + return ZONELIST_NOFALLBACK; - return 0; + return ZONELIST_FALLBACK; } /* diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index e23a9e7..9664d6c 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -576,8 +576,6 @@ static inline bool zone_is_empty(struct zone *zone) /* Maximum number of zones on a zonelist */ #define MAX_ZONES_PER_ZONELIST (MAX_NUMNODES * MAX_NR_ZONES) -#ifdef CONFIG_NUMA - /* * The NUMA zonelists are doubled because we need zonelists that restrict the * allocations to a single node for __GFP_THISNODE. @@ -585,10 +583,13 @@ static inline bool zone_is_empty(struct zone *zone) * [0] : Zonelist with fallback * [1] : No fallback (__GFP_THISNODE) */ -#define MAX_ZONELISTS 2 -#else -#define MAX_ZONELISTS 1 +enum { + ZONELIST_FALLBACK, +#ifdef CONFIG_NUMA + ZONELIST_NOFALLBACK, #endif + MAX_ZONELISTS +}; /* * This struct contains information about a zone in a zonelist. It is stored -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by kanga.kvack.org (Postfix) with ESMTP id A291C6B0038 for ; Mon, 16 Nov 2015 21:20:11 -0500 (EST) Received: by oixx65 with SMTP id x65so82650375oix.0 for ; Mon, 16 Nov 2015 18:20:11 -0800 (PST) Received: from cmccmta3.chinamobile.com (cmccmta3.chinamobile.com. [221.176.66.81]) by mx.google.com with ESMTP id az5si23741752obb.70.2015.11.16.18.20.09 for ; Mon, 16 Nov 2015 18:20:10 -0800 (PST) Date: Tue, 17 Nov 2015 10:18:56 +0800 From: Yaowei Bai Subject: Re: [PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean Message-ID: <20151117021856.GB5867@yaowei-K42JY> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-5-git-send-email-baiyaowei@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: David Rientjes Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon, Nov 16, 2015 at 02:10:10AM -0800, David Rientjes wrote: > On Mon, 16 Nov 2015, Yaowei Bai wrote: > > > diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h > > index cf55945..af73135 100644 > > --- a/include/linux/mm_inline.h > > +++ b/include/linux/mm_inline.h > > @@ -8,8 +8,8 @@ > > * page_is_file_cache - should the page be on a file LRU or anon LRU? > > * @page: the page to test > > * > > - * Returns 1 if @page is page cache page backed by a regular filesystem, > > - * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. > > + * Returns true if @page is page cache page backed by a regular filesystem, > > + * or false if @page is anonymous, tmpfs or otherwise ram or swap backed. > > * Used by functions that manipulate the LRU lists, to sort a page > > * onto the right LRU list. > > * > > @@ -17,7 +17,7 @@ > > * needs to survive until the page is last deleted from the LRU, which > > * could be as far down as __page_cache_release. > > */ > > -static inline int page_is_file_cache(struct page *page) > > +static inline bool page_is_file_cache(struct page *page) > > { > > return !PageSwapBacked(page); > > } > > Since page_is_file_cache() is often used to determine which zlc to > increment or decrement (usage such as > NR_ISOLATED_ANON + page_is_file_cache(page)), I don't think this style is > helpful. Yes, you'r right, we can drop this one. -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f48.google.com (mail-oi0-f48.google.com [209.85.218.48]) by kanga.kvack.org (Postfix) with ESMTP id 83BF76B0038 for ; Mon, 16 Nov 2015 21:41:16 -0500 (EST) Received: by oige206 with SMTP id e206so94564530oig.2 for ; Mon, 16 Nov 2015 18:41:16 -0800 (PST) Received: from cmccmta2.chinamobile.com (cmccmta2.chinamobile.com. [221.176.66.80]) by mx.google.com with ESMTP id c15si23776076obf.72.2015.11.16.18.41.14 for ; Mon, 16 Nov 2015 18:41:15 -0800 (PST) Date: Tue, 17 Nov 2015 10:40:01 +0800 From: Yaowei Bai Subject: Re: [PATCH 7/7] mm/mmzone: refactor memmap_valid_within Message-ID: <20151117024001.GC5867@yaowei-K42JY> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-8-git-send-email-baiyaowei@cmss.chinamobile.com> <20151116124501.GF14116@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151116124501.GF14116@dhcp22.suse.cz> Sender: owner-linux-mm@kvack.org List-ID: To: Michal Hocko Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon, Nov 16, 2015 at 01:45:01PM +0100, Michal Hocko wrote: > On Mon 16-11-15 14:51:26, Yaowei Bai wrote: > [...] > > @@ -72,16 +72,10 @@ struct zoneref *next_zones_zonelist(struct zoneref *z, > > } > > > > #ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL > > -int memmap_valid_within(unsigned long pfn, > > +bool memmap_valid_within(unsigned long pfn, > > struct page *page, struct zone *zone) > > { > > - if (page_to_pfn(page) != pfn) > > - return 0; > > - > > - if (page_zone(page) != zone) > > - return 0; > > - > > - return 1; > > + return page_to_pfn(page) == pfn && page_zone(page) == zone; > > I do not think this is easier to read. Quite contrary OK, so we can just make it return ture/false without refactoring it. > > > } > > #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ > > > > -- > > 1.9.1 > > > > > > -- > Michal Hocko > SUSE Labs -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by kanga.kvack.org (Postfix) with ESMTP id 8B0716B0038 for ; Tue, 17 Nov 2015 00:17:03 -0500 (EST) Received: by pacdm15 with SMTP id dm15so199034460pac.3 for ; Mon, 16 Nov 2015 21:17:03 -0800 (PST) Received: from us-alimail-mta1.hst.scl.en.alidc.net (mail113-249.mail.alibaba.com. [205.204.113.249]) by mx.google.com with ESMTP id nj10si55482545pbc.46.2015.11.16.21.17.01 for ; Mon, 16 Nov 2015 21:17:02 -0800 (PST) Reply-To: "Hillf Danton" From: "Hillf Danton" References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-6-git-send-email-baiyaowei@cmss.chinamobile.com> In-Reply-To: <1447656686-4851-6-git-send-email-baiyaowei@cmss.chinamobile.com> Subject: Re: [PATCH 5/7] mm/lru: remove unused is_unevictable_lru function Date: Tue, 17 Nov 2015 13:16:37 +0800 Message-ID: <006701d120f7$24aaa870$6dfff950$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Language: zh-cn Sender: owner-linux-mm@kvack.org List-ID: To: 'Yaowei Bai' , akpm@linux-foundation.org Cc: bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org > > Since commit a0b8cab3 ("mm: remove lru parameter from __pagevec_lru_add > and remove parts of pagevec API") there's no user of this function anymore, > so remove it. > > Signed-off-by: Yaowei Bai > --- Acked-by: Hillf Danton > include/linux/mmzone.h | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > index e23a9e7..9963846 100644 > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -195,11 +195,6 @@ static inline int is_active_lru(enum lru_list lru) > return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE); > } > > -static inline int is_unevictable_lru(enum lru_list lru) > -{ > - return (lru == LRU_UNEVICTABLE); > -} > - > struct zone_reclaim_stat { > /* > * The pageout code in vmscan.c keeps track of how many of the > -- > 1.9.1 > -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by kanga.kvack.org (Postfix) with ESMTP id 79DAE6B0038 for ; Tue, 17 Nov 2015 00:44:13 -0500 (EST) Received: by pacej9 with SMTP id ej9so93126802pac.2 for ; Mon, 16 Nov 2015 21:44:13 -0800 (PST) Received: from mail-pa0-x230.google.com (mail-pa0-x230.google.com. [2607:f8b0:400e:c03::230]) by mx.google.com with ESMTPS id xz3si55530382pbc.52.2015.11.16.21.44.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2015 21:44:12 -0800 (PST) Received: by padhx2 with SMTP id hx2so199938317pad.1 for ; Mon, 16 Nov 2015 21:44:12 -0800 (PST) Date: Mon, 16 Nov 2015 21:44:11 -0800 (PST) From: David Rientjes Subject: Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool In-Reply-To: <20151117015950.GA5867@yaowei-K42JY> Message-ID: References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-7-git-send-email-baiyaowei@cmss.chinamobile.com> <20151117015950.GA5867@yaowei-K42JY> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Yaowei Bai Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Tue, 17 Nov 2015, Yaowei Bai wrote: > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > index 6523109..14a6249 100644 > --- a/include/linux/gfp.h > +++ b/include/linux/gfp.h > @@ -378,9 +378,9 @@ static inline enum zone_type gfp_zone(gfp_t flags) > static inline int gfp_zonelist(gfp_t flags) > { > if (IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE)) > - return 1; > + return ZONELIST_NOFALLBACK; > > - return 0; > + return ZONELIST_FALLBACK; > } > > /* > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > index e23a9e7..9664d6c 100644 > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -576,8 +576,6 @@ static inline bool zone_is_empty(struct zone *zone) > /* Maximum number of zones on a zonelist */ > #define MAX_ZONES_PER_ZONELIST (MAX_NUMNODES * MAX_NR_ZONES) > > -#ifdef CONFIG_NUMA > - > /* > * The NUMA zonelists are doubled because we need zonelists that restrict the > * allocations to a single node for __GFP_THISNODE. > @@ -585,10 +583,13 @@ static inline bool zone_is_empty(struct zone *zone) > * [0] : Zonelist with fallback > * [1] : No fallback (__GFP_THISNODE) > */ > -#define MAX_ZONELISTS 2 > -#else > -#define MAX_ZONELISTS 1 > +enum { > + ZONELIST_FALLBACK, > +#ifdef CONFIG_NUMA > + ZONELIST_NOFALLBACK, > #endif > + MAX_ZONELISTS > +}; > > /* > * This struct contains information about a zone in a zonelist. It is stored This is a different change than the original. I don't see a benefit from it, but I have no strong feelings on it. If someone else finds value in this, please update the comment when defining the enum as well. -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by kanga.kvack.org (Postfix) with ESMTP id 12A426B0038 for ; Tue, 17 Nov 2015 03:31:09 -0500 (EST) Received: by pabfh17 with SMTP id fh17so2375085pab.0 for ; Tue, 17 Nov 2015 00:31:08 -0800 (PST) Received: from cmccmta1.chinamobile.com (cmccmta1.chinamobile.com. [221.176.66.79]) by mx.google.com with ESMTP id eo5si22288681pbb.133.2015.11.17.00.31.06 for ; Tue, 17 Nov 2015 00:31:07 -0800 (PST) Date: Tue, 17 Nov 2015 16:29:42 +0800 From: Yaowei Bai Subject: Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool Message-ID: <20151117082942.GA8832@yaowei-K42JY> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> <1447656686-4851-7-git-send-email-baiyaowei@cmss.chinamobile.com> <20151117015950.GA5867@yaowei-K42JY> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: David Rientjes Cc: akpm@linux-foundation.org, bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon, Nov 16, 2015 at 09:44:11PM -0800, David Rientjes wrote: > On Tue, 17 Nov 2015, Yaowei Bai wrote: > > > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > > index 6523109..14a6249 100644 > > --- a/include/linux/gfp.h > > +++ b/include/linux/gfp.h > > @@ -378,9 +378,9 @@ static inline enum zone_type gfp_zone(gfp_t flags) > > static inline int gfp_zonelist(gfp_t flags) > > { > > if (IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE)) > > - return 1; > > + return ZONELIST_NOFALLBACK; > > > > - return 0; > > + return ZONELIST_FALLBACK; > > } > > > > /* > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > > index e23a9e7..9664d6c 100644 > > --- a/include/linux/mmzone.h > > +++ b/include/linux/mmzone.h > > @@ -576,8 +576,6 @@ static inline bool zone_is_empty(struct zone *zone) > > /* Maximum number of zones on a zonelist */ > > #define MAX_ZONES_PER_ZONELIST (MAX_NUMNODES * MAX_NR_ZONES) > > > > -#ifdef CONFIG_NUMA > > - > > /* > > * The NUMA zonelists are doubled because we need zonelists that restrict the > > * allocations to a single node for __GFP_THISNODE. > > @@ -585,10 +583,13 @@ static inline bool zone_is_empty(struct zone *zone) > > * [0] : Zonelist with fallback > > * [1] : No fallback (__GFP_THISNODE) > > */ > > -#define MAX_ZONELISTS 2 > > -#else > > -#define MAX_ZONELISTS 1 > > +enum { > > + ZONELIST_FALLBACK, > > +#ifdef CONFIG_NUMA > > + ZONELIST_NOFALLBACK, > > #endif > > + MAX_ZONELISTS > > +}; > > > > /* > > * This struct contains information about a zone in a zonelist. It is stored > > This is a different change than the original. The original patch doesn't make sense as you said so let's drop it. > I don't see a benefit from > it, but I have no strong feelings on it. If someone else finds value in > this, please update the comment when defining the enum as well. OK, i'll send a update patch to review first and if nobody disagrees with it i will resend this patchset. -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by kanga.kvack.org (Postfix) with ESMTP id 63ED96B0253 for ; Tue, 17 Nov 2015 04:02:52 -0500 (EST) Received: by pabfh17 with SMTP id fh17so3246505pab.0 for ; Tue, 17 Nov 2015 01:02:52 -0800 (PST) Received: from cmccmta2.chinamobile.com (cmccmta2.chinamobile.com. [221.176.66.80]) by mx.google.com with ESMTP id k8si601107pbq.49.2015.11.17.01.02.50 for ; Tue, 17 Nov 2015 01:02:51 -0800 (PST) From: Yaowei Bai Subject: [PATCH] mm/zonelist: enumerate zonelists array index Date: Tue, 17 Nov 2015 17:02:04 +0800 Message-Id: <1447750924-9047-1-git-send-email-baiyaowei@cmss.chinamobile.com> In-Reply-To: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org Cc: bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Hardcoding index to zonelists array in gfp_zonelist() is not a good idea, let's enumerate it to improve readability. No functional change. Signed-off-by: Yaowei Bai --- include/linux/gfp.h | 4 ++-- include/linux/mmzone.h | 20 +++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 6523109..14a6249 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -378,9 +378,9 @@ static inline enum zone_type gfp_zone(gfp_t flags) static inline int gfp_zonelist(gfp_t flags) { if (IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE)) - return 1; + return ZONELIST_NOFALLBACK; - return 0; + return ZONELIST_FALLBACK; } /* diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index e23a9e7..bb31301 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -576,19 +576,17 @@ static inline bool zone_is_empty(struct zone *zone) /* Maximum number of zones on a zonelist */ #define MAX_ZONES_PER_ZONELIST (MAX_NUMNODES * MAX_NR_ZONES) +enum { + ZONELIST_FALLBACK, /* zonelist with fallback */ #ifdef CONFIG_NUMA - -/* - * The NUMA zonelists are doubled because we need zonelists that restrict the - * allocations to a single node for __GFP_THISNODE. - * - * [0] : Zonelist with fallback - * [1] : No fallback (__GFP_THISNODE) - */ -#define MAX_ZONELISTS 2 -#else -#define MAX_ZONELISTS 1 + /* + * The NUMA zonelists are doubled because we need zonelists that restrict + * the allocations to a single node for __GFP_THISNODE. + */ + ZONELIST_NOFALLBACK, /* zonelist without fallback (__GFP_THISNODE) */ #endif + MAX_ZONELISTS +}; /* * This struct contains information about a zone in a zonelist. It is stored -- 1.9.1 -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ob0-f177.google.com (mail-ob0-f177.google.com [209.85.214.177]) by kanga.kvack.org (Postfix) with ESMTP id 271686B0269 for ; Tue, 17 Nov 2015 20:40:10 -0500 (EST) Received: by obbbj7 with SMTP id bj7so22120177obb.1 for ; Tue, 17 Nov 2015 17:40:10 -0800 (PST) Received: from cmccmta2.chinamobile.com (cmccmta2.chinamobile.com. [221.176.66.80]) by mx.google.com with ESMTP id s83si212322oia.49.2015.11.17.17.40.08 for ; Tue, 17 Nov 2015 17:40:09 -0800 (PST) From: Yaowei Bai Subject: [PATCH] mm/mmzone: memmap_valid_within can be boolean Date: Wed, 18 Nov 2015 09:38:20 +0800 Message-Id: <1447810700-2535-1-git-send-email-baiyaowei@cmss.chinamobile.com> In-Reply-To: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> References: <1447656686-4851-1-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org Cc: bhe@redhat.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave@stgolabs.net, dhowells@redhat.com, dingel@linux.vnet.ibm.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, holt@sgi.com, iamjoonsoo.kim@lge.com, joe@perches.com, kuleshovmail@gmail.com, mgorman@suse.de, mhocko@suse.cz, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, penberg@kernel.org, rientjes@google.com, sasha.levin@oracle.com, tj@kernel.org, tony.luck@intel.com, vbabka@suse.cz, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org This patch makes memmap_valid_within return bool due to this particular function only using either one or zero as its return value. No functional change. Signed-off-by: Yaowei Bai --- include/linux/mmzone.h | 6 +++--- mm/mmzone.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 9963846..b9b59bb8 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1202,13 +1202,13 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long); * the zone and PFN linkages are still valid. This is expensive, but walkers * of the full memmap are extremely rare. */ -int memmap_valid_within(unsigned long pfn, +bool memmap_valid_within(unsigned long pfn, struct page *page, struct zone *zone); #else -static inline int memmap_valid_within(unsigned long pfn, +static inline bool memmap_valid_within(unsigned long pfn, struct page *page, struct zone *zone) { - return 1; + return true; } #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ diff --git a/mm/mmzone.c b/mm/mmzone.c index 7d87ebb..52687fb 100644 --- a/mm/mmzone.c +++ b/mm/mmzone.c @@ -72,16 +72,16 @@ struct zoneref *next_zones_zonelist(struct zoneref *z, } #ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL -int memmap_valid_within(unsigned long pfn, +bool memmap_valid_within(unsigned long pfn, struct page *page, struct zone *zone) { if (page_to_pfn(page) != pfn) - return 0; + return false; if (page_zone(page) != zone) - return 0; + return false; - return 1; + return true; } #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ -- 1.9.1 -- 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: email@kvack.org