From patchwork Sun Nov 1 07:46:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jungseok Lee X-Patchwork-Id: 7531651 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 2B5789F399 for ; Sun, 1 Nov 2015 07:49:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 526DB206FA for ; Sun, 1 Nov 2015 07:49:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 78243206F9 for ; Sun, 1 Nov 2015 07:49:03 +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 1ZsnMF-0003tf-P2; Sun, 01 Nov 2015 07:47:19 +0000 Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZsnM0-0003oG-Ci for linux-arm-kernel@lists.infradead.org; Sun, 01 Nov 2015 07:47:05 +0000 Received: by pacfv9 with SMTP id fv9so120446046pac.3 for ; Sun, 01 Nov 2015 00:46:43 -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:in-reply-to:references; bh=+YhGfefK25mVnyHARnRbewH8eIryE1ad/lGxOmdsqj8=; b=VZo/cHzj/spNI8Oeb4GH0EQmUbt/DbbuBsZYzW2CRQ3sS2kQfrDseDkpPPjB90P5aB htkPEQ9TiW/xbrAdb1yEYkfG6gp4li9cF7zepq1qmkzO+SFBwJd1EIqY4kiLeqNO5/// CLVgqGUH5jcvyYSOyorGwLF9vQCT6iOb/deD9zM2+r7+vnnnrXYorCh88i1oKyNt6MRb u0qwJTxSwRbxxWRjLMcmBvUM9CTcYyhCtbUtFgad+lPSFgQR7+SF2guSfR46LXuWNEhJ co2MDcMYN9lafipT4k0oKiXv8KHX4HV8fvgsxchvtDyW5HSFI2z0gytN/X33WzUCExYW yDuQ== X-Received: by 10.66.90.165 with SMTP id bx5mr19118125pab.87.1446364003696; Sun, 01 Nov 2015 00:46:43 -0700 (PDT) Received: from ip-10-189-3-143.ap-northeast-1.compute.internal (ec2-54-238-87-144.ap-northeast-1.compute.amazonaws.com. [54.238.87.144]) by smtp.gmail.com with ESMTPSA id yq2sm17285199pbb.39.2015.11.01.00.46.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 01 Nov 2015 00:46:43 -0700 (PDT) From: Jungseok Lee To: catalin.marinas@arm.com, will.deacon@arm.com, cl@linux.com, tj@kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Subject: [PATCH v6 2/3] percpu: add PERCPU_ATOM_SIZE for a generic percpu area setup Date: Sun, 1 Nov 2015 07:46:16 +0000 Message-Id: <1446363977-23656-3-git-send-email-jungseoklee85@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1446363977-23656-1-git-send-email-jungseoklee85@gmail.com> References: <1446363977-23656-1-git-send-email-jungseoklee85@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151101_004704_615063_E5E35995 X-CRM114-Status: GOOD ( 12.99 ) X-Spam-Score: -2.5 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, takahiro.akashi@linaro.org, barami97@gmail.com, james.morse@arm.com, linux-kernel@vger.kernel.org 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 There is no room to adjust 'atom_size' now when a generic percpu area is used. It would be redundant to write down an architecture-specific setup_per_cpu_areas() in order to only change the 'atom_size'. Thus, this patch adds a new definition, PERCPU_ATOM_SIZE, which is PAGE_SIZE by default. The value could be updated if needed by architecture. Signed-off-by: Jungseok Lee --- include/linux/percpu.h | 4 ++++ mm/percpu.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 4bc6daf..57a2f16 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h @@ -18,6 +18,10 @@ #define PERCPU_MODULE_RESERVE 0 #endif +#ifndef PERCPU_ATOM_SIZE +#define PERCPU_ATOM_SIZE PAGE_SIZE +#endif + /* minimum unit size, also is the maximum supported allocation size */ #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10) diff --git a/mm/percpu.c b/mm/percpu.c index a63b4d8..cd1e0ec 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -2201,8 +2201,8 @@ void __init setup_per_cpu_areas(void) * what the legacy allocator did. */ rc = pcpu_embed_first_chunk(PERCPU_MODULE_RESERVE, - PERCPU_DYNAMIC_RESERVE, PAGE_SIZE, NULL, - pcpu_dfl_fc_alloc, pcpu_dfl_fc_free); + PERCPU_DYNAMIC_RESERVE, PERCPU_ATOM_SIZE, + NULL, pcpu_dfl_fc_alloc, pcpu_dfl_fc_free); if (rc < 0) panic("Failed to initialize percpu areas."); @@ -2231,7 +2231,7 @@ void __init setup_per_cpu_areas(void) ai = pcpu_alloc_alloc_info(1, 1); fc = memblock_virt_alloc_from_nopanic(unit_size, - PAGE_SIZE, + PERCPU_ATOM_SIZE, __pa(MAX_DMA_ADDRESS)); if (!ai || !fc) panic("Failed to allocate memory for percpu areas.");