mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org>
To: akpm@osdl.org
Cc: apw@shadowen.org, linux-kernel@vger.kernel.org
Subject: [PATCH] use page_to_nid
Date: Thu, 26 Aug 2004 11:08:47 +0100	[thread overview]
Message-ID: <E1C0HBX-0003A4-E8@localhost.localdomain> (raw)

There are a couple of places where we seem to go round the houses
to get the numa node id from a page.  We have a macro for this
so it seems sensible to use that.

-apw

=== 8< ===
Both lookup_node and enqueue_huge_page use page_zone() to locate
the zone, that to locate node pgdat_t and that to get the node_id.
Its more efficient to use page_to_nid() which gets the nid from the
page flags, especially if we are not using the zone for anything
else it.  Change these to use page_to_nid().

Revision: $Rev: 494 $

Signed-off-by: Andy Whitcroft <apw@shadowen.org>

diffstat 100-use_page_to_nid
---
 hugetlb.c   |    2 +-
 mempolicy.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff -X /home/apw/brief/lib/vdiff.excl -rupN reference/mm/hugetlb.c current/mm/hugetlb.c
--- reference/mm/hugetlb.c	2004-08-06 10:00:18.000000000 +0100
+++ current/mm/hugetlb.c	2004-08-06 13:39:26.000000000 +0100
@@ -21,7 +21,7 @@ static spinlock_t hugetlb_lock = SPIN_LO
 
 static void enqueue_huge_page(struct page *page)
 {
-	int nid = page_zone(page)->zone_pgdat->node_id;
+	int nid = page_to_nid(page);
 	list_add(&page->lru, &hugepage_freelists[nid]);
 	free_huge_pages++;
 	free_huge_pages_node[nid]++;
diff -X /home/apw/brief/lib/vdiff.excl -rupN reference/mm/mempolicy.c current/mm/mempolicy.c
--- reference/mm/mempolicy.c	2004-08-06 10:00:18.000000000 +0100
+++ current/mm/mempolicy.c	2004-08-06 13:33:36.000000000 +0100
@@ -438,7 +438,7 @@ static int lookup_node(struct mm_struct 
 
 	err = get_user_pages(current, mm, addr & PAGE_MASK, 1, 0, 0, &p, NULL);
 	if (err >= 0) {
-		err = page_zone(p)->zone_pgdat->node_id;
+		err = page_to_nid(p);
 		put_page(p);
 	}
 	return err;

                 reply	other threads:[~2004-08-26 10:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1C0HBX-0003A4-E8@localhost.localdomain \
    --to=apw@shadowen.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®