From patchwork Sun May 24 16:01:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jungseok Lee X-Patchwork-Id: 6472181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 92DF69F38C for ; Sun, 24 May 2015 16:04:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E266420546 for ; Sun, 24 May 2015 16:04:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1138E2053D for ; Sun, 24 May 2015 16:04:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YwYLq-0000NW-En; Sun, 24 May 2015 16:02:10 +0000 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YwYLl-0000HY-4p for linux-arm-kernel@lists.infradead.org; Sun, 24 May 2015 16:02:08 +0000 Received: by pabru16 with SMTP id ru16so54642264pab.1 for ; Sun, 24 May 2015 09:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=n/pJ4AqzRrdvWfw8vxhXN3YlFh3IJDB/bTBapo2dDEY=; b=er9CdhNWkpXuq2l9SzrC9L3xphoTfUIy5VHfitejkPoTA4msRNFLQeSKCrTNv5WHPV rsL6+4BerwH+GFSSi/Rl58QJxKpgNO+GmBqLFM1Q++GPO5Bc5al5gjmRF7OaPmMubdJ6 9Clxjvqyq28cxSdgNqSJCguOdqAY0wS70D5AEo4RXq4/Pa6WpZEyAJWjTOvQUp/STV3L To42PykuVnDua8toI2Tc1XEl6kgFyM8FGusR1jOOzDcHT20qoF9POe+SjvyL8O3g0pBy c0qC14baS6vrcz5y098sm3Gd7B8lLM4zEVu4YRHokqdoWwiz+REfUjxhdfm1PmpeMjma hwEw== X-Received: by 10.68.57.209 with SMTP id k17mr32791423pbq.118.1432483303996; Sun, 24 May 2015 09:01:43 -0700 (PDT) Received: from localhost.localdomain ([116.121.77.221]) by mx.google.com with ESMTPSA id a10sm4875619pdn.57.2015.05.24.09.01.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 May 2015 09:01:43 -0700 (PDT) From: Jungseok Lee To: linux-kernel@vger.kernel.org, linux-mm@kvack.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 Message-Id: <1432483292-23109-1-git-send-email-jungseoklee85@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150524_090205_212596_23796282 X-CRM114-Status: UNSURE ( 9.39 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.6 (/) Cc: barami97@gmail.com, linux-arm-kernel@lists.infradead.org, KOSAKI Motohiro X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Jungseok Lee Cc: KOSAKI Motohiro Cc: linux-arm-kernel@lists.infradead.org Acked-by: KOSAKI Motohiro --- 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); }