linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jungseok Lee <jungseoklee85@gmail.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: barami97@gmail.com,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 1/2] kernel/fork.c: add a function to calculate page address from thread_info
Date: Mon, 25 May 2015 01:01:32 +0900	[thread overview]
Message-ID: <1432483292-23109-1-git-send-email-jungseoklee85@gmail.com> (raw)

A current implementation assumes thread_info address is always correctly
calculated via virt_to_page. It restricts a different approach, such as
thread_info allocation from vmalloc space.

This patch, thus, introduces an independent function to calculate page
address from thread_info one.

Suggested-by: Sungjinn Chung <barami97@gmail.com>
Signed-off-by: Jungseok Lee <jungseoklee85@gmail.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 kernel/fork.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 03c1eaa..6300bbd 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -212,9 +212,14 @@ struct kmem_cache *vm_area_cachep;
 /* SLAB cache for mm_struct structures (tsk->mm) */
 static struct kmem_cache *mm_cachep;
 
+struct page * __weak arch_thread_info_to_page(struct thread_info *ti)
+{
+	return virt_to_page(ti);
+}
+
 static void account_kernel_stack(struct thread_info *ti, int account)
 {
-	struct zone *zone = page_zone(virt_to_page(ti));
+	struct zone *zone = page_zone(arch_thread_info_to_page(ti));
 
 	mod_zone_page_state(zone, NR_KERNEL_STACK, account);
 }
-- 
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2015-05-24 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-24 16:01 Jungseok Lee [this message]
2015-05-27  3:49 ` KOSAKI Motohiro
2015-05-27 15:19   ` Jungseok Lee

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=1432483292-23109-1-git-send-email-jungseoklee85@gmail.com \
    --to=jungseoklee85@gmail.com \
    --cc=barami97@gmail.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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