From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
mtosatti@redhat.com, aarcange@redhat.com, mgorman@suse.de,
akpm@linux-foundation.org, andi@firstfloor.org, davidlohr@hp.com,
rientjes@google.com, yinghai@kernel.org, riel@redhat.com
Subject: Re: [PATCH 3/4] hugetlb: move helpers up in the file
Date: Tue, 8 Apr 2014 11:01:54 +0900 [thread overview]
Message-ID: <53435892.8070607@jp.fujitsu.com> (raw)
In-Reply-To: <1396462128-32626-4-git-send-email-lcapitulino@redhat.com>
(2014/04/03 3:08), Luiz Capitulino wrote:
> Next commit will add new code which will want to call the
> for_each_node_mask_to_alloc() macro. Move it, its buddy
> for_each_node_mask_to_free() and their dependencies up in the file so
> the new code can use them. This is just code movement, no logic change.
>
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Thanks,
Yasuaki Ishimatsu
> mm/hugetlb.c | 146 +++++++++++++++++++++++++++++------------------------------
> 1 file changed, 73 insertions(+), 73 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 7e07e47..2c7a44a 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -570,6 +570,79 @@ err:
> return NULL;
> }
>
> +/*
> + * common helper functions for hstate_next_node_to_{alloc|free}.
> + * We may have allocated or freed a huge page based on a different
> + * nodes_allowed previously, so h->next_node_to_{alloc|free} might
> + * be outside of *nodes_allowed. Ensure that we use an allowed
> + * node for alloc or free.
> + */
> +static int next_node_allowed(int nid, nodemask_t *nodes_allowed)
> +{
> + nid = next_node(nid, *nodes_allowed);
> + if (nid == MAX_NUMNODES)
> + nid = first_node(*nodes_allowed);
> + VM_BUG_ON(nid >= MAX_NUMNODES);
> +
> + return nid;
> +}
> +
> +static int get_valid_node_allowed(int nid, nodemask_t *nodes_allowed)
> +{
> + if (!node_isset(nid, *nodes_allowed))
> + nid = next_node_allowed(nid, nodes_allowed);
> + return nid;
> +}
> +
> +/*
> + * returns the previously saved node ["this node"] from which to
> + * allocate a persistent huge page for the pool and advance the
> + * next node from which to allocate, handling wrap at end of node
> + * mask.
> + */
> +static int hstate_next_node_to_alloc(struct hstate *h,
> + nodemask_t *nodes_allowed)
> +{
> + int nid;
> +
> + VM_BUG_ON(!nodes_allowed);
> +
> + nid = get_valid_node_allowed(h->next_nid_to_alloc, nodes_allowed);
> + h->next_nid_to_alloc = next_node_allowed(nid, nodes_allowed);
> +
> + return nid;
> +}
> +
> +/*
> + * helper for free_pool_huge_page() - return the previously saved
> + * node ["this node"] from which to free a huge page. Advance the
> + * next node id whether or not we find a free huge page to free so
> + * that the next attempt to free addresses the next node.
> + */
> +static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed)
> +{
> + int nid;
> +
> + VM_BUG_ON(!nodes_allowed);
> +
> + nid = get_valid_node_allowed(h->next_nid_to_free, nodes_allowed);
> + h->next_nid_to_free = next_node_allowed(nid, nodes_allowed);
> +
> + return nid;
> +}
> +
> +#define for_each_node_mask_to_alloc(hs, nr_nodes, node, mask) \
> + for (nr_nodes = nodes_weight(*mask); \
> + nr_nodes > 0 && \
> + ((node = hstate_next_node_to_alloc(hs, mask)) || 1); \
> + nr_nodes--)
> +
> +#define for_each_node_mask_to_free(hs, nr_nodes, node, mask) \
> + for (nr_nodes = nodes_weight(*mask); \
> + nr_nodes > 0 && \
> + ((node = hstate_next_node_to_free(hs, mask)) || 1); \
> + nr_nodes--)
> +
> static void update_and_free_page(struct hstate *h, struct page *page)
> {
> int i;
> @@ -750,79 +823,6 @@ static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)
> return page;
> }
>
> -/*
> - * common helper functions for hstate_next_node_to_{alloc|free}.
> - * We may have allocated or freed a huge page based on a different
> - * nodes_allowed previously, so h->next_node_to_{alloc|free} might
> - * be outside of *nodes_allowed. Ensure that we use an allowed
> - * node for alloc or free.
> - */
> -static int next_node_allowed(int nid, nodemask_t *nodes_allowed)
> -{
> - nid = next_node(nid, *nodes_allowed);
> - if (nid == MAX_NUMNODES)
> - nid = first_node(*nodes_allowed);
> - VM_BUG_ON(nid >= MAX_NUMNODES);
> -
> - return nid;
> -}
> -
> -static int get_valid_node_allowed(int nid, nodemask_t *nodes_allowed)
> -{
> - if (!node_isset(nid, *nodes_allowed))
> - nid = next_node_allowed(nid, nodes_allowed);
> - return nid;
> -}
> -
> -/*
> - * returns the previously saved node ["this node"] from which to
> - * allocate a persistent huge page for the pool and advance the
> - * next node from which to allocate, handling wrap at end of node
> - * mask.
> - */
> -static int hstate_next_node_to_alloc(struct hstate *h,
> - nodemask_t *nodes_allowed)
> -{
> - int nid;
> -
> - VM_BUG_ON(!nodes_allowed);
> -
> - nid = get_valid_node_allowed(h->next_nid_to_alloc, nodes_allowed);
> - h->next_nid_to_alloc = next_node_allowed(nid, nodes_allowed);
> -
> - return nid;
> -}
> -
> -/*
> - * helper for free_pool_huge_page() - return the previously saved
> - * node ["this node"] from which to free a huge page. Advance the
> - * next node id whether or not we find a free huge page to free so
> - * that the next attempt to free addresses the next node.
> - */
> -static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed)
> -{
> - int nid;
> -
> - VM_BUG_ON(!nodes_allowed);
> -
> - nid = get_valid_node_allowed(h->next_nid_to_free, nodes_allowed);
> - h->next_nid_to_free = next_node_allowed(nid, nodes_allowed);
> -
> - return nid;
> -}
> -
> -#define for_each_node_mask_to_alloc(hs, nr_nodes, node, mask) \
> - for (nr_nodes = nodes_weight(*mask); \
> - nr_nodes > 0 && \
> - ((node = hstate_next_node_to_alloc(hs, mask)) || 1); \
> - nr_nodes--)
> -
> -#define for_each_node_mask_to_free(hs, nr_nodes, node, mask) \
> - for (nr_nodes = nodes_weight(*mask); \
> - nr_nodes > 0 && \
> - ((node = hstate_next_node_to_free(hs, mask)) || 1); \
> - nr_nodes--)
> -
> static int alloc_fresh_huge_page(struct hstate *h, nodemask_t *nodes_allowed)
> {
> struct page *page;
>
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
<mtosatti@redhat.com>, <aarcange@redhat.com>, <mgorman@suse.de>,
<akpm@linux-foundation.org>, <andi@firstfloor.org>,
<davidlohr@hp.com>, <rientjes@google.com>, <yinghai@kernel.org>,
<riel@redhat.com>
Subject: Re: [PATCH 3/4] hugetlb: move helpers up in the file
Date: Tue, 8 Apr 2014 11:01:54 +0900 [thread overview]
Message-ID: <53435892.8070607@jp.fujitsu.com> (raw)
In-Reply-To: <1396462128-32626-4-git-send-email-lcapitulino@redhat.com>
(2014/04/03 3:08), Luiz Capitulino wrote:
> Next commit will add new code which will want to call the
> for_each_node_mask_to_alloc() macro. Move it, its buddy
> for_each_node_mask_to_free() and their dependencies up in the file so
> the new code can use them. This is just code movement, no logic change.
>
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Thanks,
Yasuaki Ishimatsu
> mm/hugetlb.c | 146 +++++++++++++++++++++++++++++------------------------------
> 1 file changed, 73 insertions(+), 73 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 7e07e47..2c7a44a 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -570,6 +570,79 @@ err:
> return NULL;
> }
>
> +/*
> + * common helper functions for hstate_next_node_to_{alloc|free}.
> + * We may have allocated or freed a huge page based on a different
> + * nodes_allowed previously, so h->next_node_to_{alloc|free} might
> + * be outside of *nodes_allowed. Ensure that we use an allowed
> + * node for alloc or free.
> + */
> +static int next_node_allowed(int nid, nodemask_t *nodes_allowed)
> +{
> + nid = next_node(nid, *nodes_allowed);
> + if (nid == MAX_NUMNODES)
> + nid = first_node(*nodes_allowed);
> + VM_BUG_ON(nid >= MAX_NUMNODES);
> +
> + return nid;
> +}
> +
> +static int get_valid_node_allowed(int nid, nodemask_t *nodes_allowed)
> +{
> + if (!node_isset(nid, *nodes_allowed))
> + nid = next_node_allowed(nid, nodes_allowed);
> + return nid;
> +}
> +
> +/*
> + * returns the previously saved node ["this node"] from which to
> + * allocate a persistent huge page for the pool and advance the
> + * next node from which to allocate, handling wrap at end of node
> + * mask.
> + */
> +static int hstate_next_node_to_alloc(struct hstate *h,
> + nodemask_t *nodes_allowed)
> +{
> + int nid;
> +
> + VM_BUG_ON(!nodes_allowed);
> +
> + nid = get_valid_node_allowed(h->next_nid_to_alloc, nodes_allowed);
> + h->next_nid_to_alloc = next_node_allowed(nid, nodes_allowed);
> +
> + return nid;
> +}
> +
> +/*
> + * helper for free_pool_huge_page() - return the previously saved
> + * node ["this node"] from which to free a huge page. Advance the
> + * next node id whether or not we find a free huge page to free so
> + * that the next attempt to free addresses the next node.
> + */
> +static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed)
> +{
> + int nid;
> +
> + VM_BUG_ON(!nodes_allowed);
> +
> + nid = get_valid_node_allowed(h->next_nid_to_free, nodes_allowed);
> + h->next_nid_to_free = next_node_allowed(nid, nodes_allowed);
> +
> + return nid;
> +}
> +
> +#define for_each_node_mask_to_alloc(hs, nr_nodes, node, mask) \
> + for (nr_nodes = nodes_weight(*mask); \
> + nr_nodes > 0 && \
> + ((node = hstate_next_node_to_alloc(hs, mask)) || 1); \
> + nr_nodes--)
> +
> +#define for_each_node_mask_to_free(hs, nr_nodes, node, mask) \
> + for (nr_nodes = nodes_weight(*mask); \
> + nr_nodes > 0 && \
> + ((node = hstate_next_node_to_free(hs, mask)) || 1); \
> + nr_nodes--)
> +
> static void update_and_free_page(struct hstate *h, struct page *page)
> {
> int i;
> @@ -750,79 +823,6 @@ static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)
> return page;
> }
>
> -/*
> - * common helper functions for hstate_next_node_to_{alloc|free}.
> - * We may have allocated or freed a huge page based on a different
> - * nodes_allowed previously, so h->next_node_to_{alloc|free} might
> - * be outside of *nodes_allowed. Ensure that we use an allowed
> - * node for alloc or free.
> - */
> -static int next_node_allowed(int nid, nodemask_t *nodes_allowed)
> -{
> - nid = next_node(nid, *nodes_allowed);
> - if (nid == MAX_NUMNODES)
> - nid = first_node(*nodes_allowed);
> - VM_BUG_ON(nid >= MAX_NUMNODES);
> -
> - return nid;
> -}
> -
> -static int get_valid_node_allowed(int nid, nodemask_t *nodes_allowed)
> -{
> - if (!node_isset(nid, *nodes_allowed))
> - nid = next_node_allowed(nid, nodes_allowed);
> - return nid;
> -}
> -
> -/*
> - * returns the previously saved node ["this node"] from which to
> - * allocate a persistent huge page for the pool and advance the
> - * next node from which to allocate, handling wrap at end of node
> - * mask.
> - */
> -static int hstate_next_node_to_alloc(struct hstate *h,
> - nodemask_t *nodes_allowed)
> -{
> - int nid;
> -
> - VM_BUG_ON(!nodes_allowed);
> -
> - nid = get_valid_node_allowed(h->next_nid_to_alloc, nodes_allowed);
> - h->next_nid_to_alloc = next_node_allowed(nid, nodes_allowed);
> -
> - return nid;
> -}
> -
> -/*
> - * helper for free_pool_huge_page() - return the previously saved
> - * node ["this node"] from which to free a huge page. Advance the
> - * next node id whether or not we find a free huge page to free so
> - * that the next attempt to free addresses the next node.
> - */
> -static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed)
> -{
> - int nid;
> -
> - VM_BUG_ON(!nodes_allowed);
> -
> - nid = get_valid_node_allowed(h->next_nid_to_free, nodes_allowed);
> - h->next_nid_to_free = next_node_allowed(nid, nodes_allowed);
> -
> - return nid;
> -}
> -
> -#define for_each_node_mask_to_alloc(hs, nr_nodes, node, mask) \
> - for (nr_nodes = nodes_weight(*mask); \
> - nr_nodes > 0 && \
> - ((node = hstate_next_node_to_alloc(hs, mask)) || 1); \
> - nr_nodes--)
> -
> -#define for_each_node_mask_to_free(hs, nr_nodes, node, mask) \
> - for (nr_nodes = nodes_weight(*mask); \
> - nr_nodes > 0 && \
> - ((node = hstate_next_node_to_free(hs, mask)) || 1); \
> - nr_nodes--)
> -
> static int alloc_fresh_huge_page(struct hstate *h, nodemask_t *nodes_allowed)
> {
> struct page *page;
>
next prev parent reply other threads:[~2014-04-08 3:42 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-02 18:08 [PATCH 0/4] hugetlb: add support gigantic page allocation at runtime Luiz Capitulino
2014-04-02 18:08 ` Luiz Capitulino
2014-04-02 18:08 ` [PATCH 1/4] hugetlb: add hstate_is_gigantic() Luiz Capitulino
2014-04-02 18:08 ` Luiz Capitulino
2014-04-07 17:57 ` Naoya Horiguchi
2014-04-08 2:00 ` Yasuaki Ishimatsu
2014-04-08 2:00 ` Yasuaki Ishimatsu
2014-04-02 18:08 ` [PATCH 2/4] hugetlb: update_and_free_page(): don't clear PG_reserved bit Luiz Capitulino
2014-04-02 18:08 ` Luiz Capitulino
2014-04-07 17:58 ` Naoya Horiguchi
2014-04-08 2:01 ` Yasuaki Ishimatsu
2014-04-08 2:01 ` Yasuaki Ishimatsu
2014-04-02 18:08 ` [PATCH 3/4] hugetlb: move helpers up in the file Luiz Capitulino
2014-04-02 18:08 ` Luiz Capitulino
2014-04-07 17:58 ` Naoya Horiguchi
2014-04-08 2:01 ` Yasuaki Ishimatsu [this message]
2014-04-08 2:01 ` Yasuaki Ishimatsu
2014-04-02 18:08 ` [PATCH 4/4] hugetlb: add support for gigantic page allocation at runtime Luiz Capitulino
2014-04-02 18:08 ` Luiz Capitulino
2014-04-04 3:05 ` Yasuaki Ishimatsu
2014-04-04 3:05 ` Yasuaki Ishimatsu
2014-04-04 13:30 ` Luiz Capitulino
2014-04-04 13:30 ` Luiz Capitulino
2014-04-08 1:58 ` Yasuaki Ishimatsu
2014-04-08 1:58 ` Yasuaki Ishimatsu
2014-04-07 17:58 ` Naoya Horiguchi
[not found] ` <1396893509-x52fgnka@n-horiguchi@ah.jp.nec.com>
2014-04-07 18:49 ` Luiz Capitulino
2014-04-07 19:03 ` Naoya Horiguchi
2014-04-08 22:51 ` Andrew Morton
2014-04-08 22:51 ` Andrew Morton
2014-04-09 0:29 ` Luiz Capitulino
2014-04-09 0:29 ` Luiz Capitulino
2014-04-03 15:33 ` [PATCH 0/4] hugetlb: add support " Andrea Arcangeli
2014-04-03 15:33 ` Andrea Arcangeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53435892.8070607@jp.fujitsu.com \
--to=isimatu.yasuaki@jp.fujitsu.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=davidlohr@hp.com \
--cc=lcapitulino@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mtosatti@redhat.com \
--cc=riel@redhat.com \
--cc=rientjes@google.com \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.