From patchwork Mon Apr 1 18:42:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniy Paltsev X-Patchwork-Id: 1073125 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AiS3iOH2"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.b="J7CZLbqC"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44Y1Sm01CSz9sPj for ; Tue, 2 Apr 2019 05:43:36 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Fc5DgPqxfgUzDTLyoE3mhJZS9epTxLuyOPVbWOUB3OA=; b=AiS 3iOH20uDAU3c2vaLsxcwIeHTZ/dLeJumqfoYtaqpU13drvwPvetYblz/+yI78Fg5ez2XlUDUcLq9i lMCmlFN7d+4RWRu8YrGZzi1Z/6s3iVR4G/+G8Py/uieHpGMCS5ARsjDgIK+yBAMqTiSgQyKS1VEL3 KigcJa1n0w/Wa4bf42a5UTRGmo0bzuck0aDTpnehYvbReH1iXEf2Z+eqimmlw3WdLYwL3N+ulVR83 P9EwckNnc9ydOQcPr2HlkhthYr3akf/jdBoqqRKPkbhm4mquxSKCCHzXoqHZcanocaYksV2vSGX0d Y56/ehbCnBSUhRz0RmUVmojFUlY2wXg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1uA-0000MV-6H; Mon, 01 Apr 2019 18:43:34 +0000 Received: from smtprelay.synopsys.com ([198.182.47.9]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1u8-0000M8-2x for linux-snps-arc@lists.infradead.org; Mon, 01 Apr 2019 18:43:33 +0000 Received: from mailhost.synopsys.com (dc8-mailhost2.synopsys.com [10.13.135.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id C09B424E28DF; Mon, 1 Apr 2019 11:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1554144211; bh=/Sb7ii47xyMFrm/jOGOPlK+eRZjqEj1UcszpvGYSL8I=; h=From:To:Cc:Subject:Date:From; b=J7CZLbqCx4x40b0IM111kgO1xvCa3+eNV0vw9VEw4Mm4R+gH9uOj9ZyDyY8r297Si ZETjNFWMPNAvY89KyNw2HgiyxZe5wOUxqGE5WPnQMoF/AlmPKdIRMp6LVt7HNJqen8 WqTsrKDOGZNLEiIvwJxQ0ZUrYnFCdRYIdlk4NPUgZJQ576UUeGaUpUPOSG+2Q7CR7Q +zPcx3ksdIieGe1Buv6zy7ReGn8pcAtQe/N0qbE/c/hou4YVTz1tbyqoEd36nwGeoE AVGOGd1KIefSdMD+mY+g5/zCgynBfA0EE/1ZEjUvd/4M1tT4l5oQmNrCalqE/et1yy NVRV4jJP/uKXA== Received: from paltsev-e7480.internal.synopsys.com (paltsev-e7480.internal.synopsys.com [10.121.8.106]) by mailhost.synopsys.com (Postfix) with ESMTP id C4D20A005A; Mon, 1 Apr 2019 18:43:29 +0000 (UTC) From: Eugeniy Paltsev To: linux-snps-arc@lists.infradead.org, Vineet Gupta Subject: [PATCH] ARC: fix memory nodes topology in case of highmem enabled Date: Mon, 1 Apr 2019 21:42:42 +0300 Message-Id: <20190401184242.7636-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.14.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_114332_130530_22276759 X-CRM114-Status: GOOD ( 13.74 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, Alexey Brodkin , Eugeniy Paltsev , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Tweak generic node topology in case of CONFIG_HIGHMEM enabled to prioritize allocations from ZONE_HIGHMEM to avoid ZONE_NORMAL pressure. Signed-off-by: Eugeniy Paltsev --- Tested on both NSIM and HSDK (require memory apertures remmaping and device tree patching) arch/arc/include/asm/Kbuild | 1 - arch/arc/include/asm/topology.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 arch/arc/include/asm/topology.h diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild index caa270261521..e64e0439baff 100644 --- a/arch/arc/include/asm/Kbuild +++ b/arch/arc/include/asm/Kbuild @@ -18,7 +18,6 @@ generic-y += msi.h generic-y += parport.h generic-y += percpu.h generic-y += preempt.h -generic-y += topology.h generic-y += trace_clock.h generic-y += user.h generic-y += vga.h diff --git a/arch/arc/include/asm/topology.h b/arch/arc/include/asm/topology.h new file mode 100644 index 000000000000..c273506931c9 --- /dev/null +++ b/arch/arc/include/asm/topology.h @@ -0,0 +1,30 @@ +#ifndef _ASM_ARC_TOPOLOGY_H +#define _ASM_ARC_TOPOLOGY_H + +/* + * On ARC (w/o PAE) HIGHMEM addresses are smaller (0x0 based) than addresses in + * NORMAL aka low memory (0x8000_0000 based). + * Thus HIGHMEM on ARC is imlemented with DISCONTIGMEM which requires multiple + * nodes. So here is memory node map depending on the CONFIG_HIGHMEM + * enabled/disabled: + * + * CONFIG_HIGHMEM disabled: + * - node 0: ZONE_NORMAL memory only. + * + * CONFIG_HIGHMEM enabled: + * - node 0: ZONE_NORMAL memory only. + * - node 1: ZONE_HIGHMEM memory only. + * + * In case of CONFIG_HIGHMEM enabled we tweak generic node topology and mark + * node 1 as the closest to all CPUs to prioritize allocations from ZONE_HIGHMEM + * where it is possible to avoid ZONE_NORMAL pressure. + */ +#ifdef CONFIG_HIGHMEM +#define cpu_to_node(cpu) ((void)(cpu), 1) +#define cpu_to_mem(cpu) ((void)(cpu), 1) +#define cpumask_of_node(node) ((node) == 1 ? cpu_online_mask : cpu_none_mask) +#endif /* CONFIG_HIGHMEM */ + +#include + +#endif /* _ASM_ARC_TOPOLOGY_H */