Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1269867 > unrolled thread

[PATCH 0/7] some small improvement

Started byYaowei Bai <baiyaowei@cmss.chinamobile.com>
First post2015-11-16 08:00 +0100
Last post2015-11-18 02:40 +0100
Articles 11 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/7] some small improvement Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2015-11-16 08:00 +0100
    [PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2015-11-16 08:00 +0100
      Re: [PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean David Rientjes <rientjes@google.com> - 2015-11-16 11:20 +0100
        Re: [PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2015-11-17 03:20 +0100
    [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2015-11-16 08:00 +0100
      Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool David Rientjes <rientjes@google.com> - 2015-11-16 11:10 +0100
        Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2015-11-17 03:10 +0100
          Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool David Rientjes <rientjes@google.com> - 2015-11-17 06:50 +0100
            Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2015-11-17 09:40 +0100
    [PATCH] mm/zonelist: enumerate zonelists array index Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2015-11-17 10:10 +0100
    [PATCH] mm/mmzone: memmap_valid_within can be boolean Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2015-11-18 02:40 +0100

#1269867 — [PATCH 0/7] some small improvement

FromYaowei Bai <baiyaowei@cmss.chinamobile.com>
Date2015-11-16 08:00 +0100
Subject[PATCH 0/7] some small improvement
Message-ID<qvlVD-3Sn-3@gated-at.bofh.it>
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1269868 — [PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean

FromYaowei Bai <baiyaowei@cmss.chinamobile.com>
Date2015-11-16 08:00 +0100
Subject[PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean
Message-ID<qvlVE-3Sn-21@gated-at.bofh.it>
In reply to#1269867
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 <baiyaowei@cmss.chinamobile.com>
---
 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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1269962 — Re: [PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean

FromDavid Rientjes <rientjes@google.com>
Date2015-11-16 11:20 +0100
SubjectRe: [PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean
Message-ID<qvp3b-62P-1@gated-at.bofh.it>
In reply to#1269868
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1270767 — Re: [PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean

FromYaowei Bai <baiyaowei@cmss.chinamobile.com>
Date2015-11-17 03:20 +0100
SubjectRe: [PATCH 4/7] mm/vmscan: page_is_file_cache can be boolean
Message-ID<qvE2d-79i-5@gated-at.bofh.it>
In reply to#1269962
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1269870 — [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool

FromYaowei Bai <baiyaowei@cmss.chinamobile.com>
Date2015-11-16 08:00 +0100
Subject[PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool
Message-ID<qvlVF-3Sn-23@gated-at.bofh.it>
In reply to#1269867
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 <baiyaowei@cmss.chinamobile.com>
---
 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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1269959 — Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool

FromDavid Rientjes <rientjes@google.com>
Date2015-11-16 11:10 +0100
SubjectRe: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool
Message-ID<qvoTw-5Zc-9@gated-at.bofh.it>
In reply to#1269870
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1270765 — Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool

FromYaowei Bai <baiyaowei@cmss.chinamobile.com>
Date2015-11-17 03:10 +0100
SubjectRe: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool
Message-ID<qvDSy-75S-3@gated-at.bofh.it>
In reply to#1269959
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1270883 — Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool

FromDavid Rientjes <rientjes@google.com>
Date2015-11-17 06:50 +0100
SubjectRe: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool
Message-ID<qvHjr-QF-3@gated-at.bofh.it>
In reply to#1270765
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1270959 — Re: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool

FromYaowei Bai <baiyaowei@cmss.chinamobile.com>
Date2015-11-17 09:40 +0100
SubjectRe: [PATCH 6/7] mm/gfp: make gfp_zonelist return directly and bool
Message-ID<qvJXY-2zA-21@gated-at.bofh.it>
In reply to#1270883
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1270975 — [PATCH] mm/zonelist: enumerate zonelists array index

FromYaowei Bai <baiyaowei@cmss.chinamobile.com>
Date2015-11-17 10:10 +0100
Subject[PATCH] mm/zonelist: enumerate zonelists array index
Message-ID<qvKqZ-31p-1@gated-at.bofh.it>
In reply to#1269867
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 <baiyaowei@cmss.chinamobile.com>
---
 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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1271804 — [PATCH] mm/mmzone: memmap_valid_within can be boolean

FromYaowei Bai <baiyaowei@cmss.chinamobile.com>
Date2015-11-18 02:40 +0100
Subject[PATCH] mm/mmzone: memmap_valid_within can be boolean
Message-ID<qvZT3-4sK-3@gated-at.bofh.it>
In reply to#1269867
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 <baiyaowei@cmss.chinamobile.com>
---
 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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web