From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6529CC48BE8 for ; Wed, 16 Jun 2021 17:10:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D34E760E09 for ; Wed, 16 Jun 2021 17:10:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D34E760E09 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6C86E6B0036; Wed, 16 Jun 2021 13:10:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68DDD6B006C; Wed, 16 Jun 2021 13:10:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52DAE6B0070; Wed, 16 Jun 2021 13:10:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0077.hostedemail.com [216.40.44.77]) by kanga.kvack.org (Postfix) with ESMTP id 258816B0036 for ; Wed, 16 Jun 2021 13:10:11 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id AEED412604 for ; Wed, 16 Jun 2021 17:10:10 +0000 (UTC) X-FDA: 78260224980.34.DF3D140 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf13.hostedemail.com (Postfix) with ESMTP id 4592CE0004C0 for ; Wed, 16 Jun 2021 17:10:00 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 606C521A64; Wed, 16 Jun 2021 17:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623863407; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QPGfbGElVJ2SXppTW6aIgd8Twb2wKaHsMDX214lrojE=; b=mriEgvvv4Ne7kbJgIGJTo/dH0YdJ3uhhjjv1hHpbp0mmOWuw8r9YU2tvWj0r5mI+bsI1G8 3upWXKO4cmFF3kx5YeMZk5aenv6HvI66ukxzlRXM9GFbYmvqNBll9XCKJZnNyuEMsmCO1x q0HIzLALFlL6rdPARBnR7QU0YdXg3n0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623863407; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QPGfbGElVJ2SXppTW6aIgd8Twb2wKaHsMDX214lrojE=; b=s76ZnqiB+uCytlEJOQ60UH/A3nnhZNuVPZcGOuB47RpaLjcpvPk81FnpcK3Lae3YQPv6yG kVEzlxW8cv9wgQAQ== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 3C73F118DD; Wed, 16 Jun 2021 17:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623863407; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QPGfbGElVJ2SXppTW6aIgd8Twb2wKaHsMDX214lrojE=; b=mriEgvvv4Ne7kbJgIGJTo/dH0YdJ3uhhjjv1hHpbp0mmOWuw8r9YU2tvWj0r5mI+bsI1G8 3upWXKO4cmFF3kx5YeMZk5aenv6HvI66ukxzlRXM9GFbYmvqNBll9XCKJZnNyuEMsmCO1x q0HIzLALFlL6rdPARBnR7QU0YdXg3n0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623863407; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QPGfbGElVJ2SXppTW6aIgd8Twb2wKaHsMDX214lrojE=; b=s76ZnqiB+uCytlEJOQ60UH/A3nnhZNuVPZcGOuB47RpaLjcpvPk81FnpcK3Lae3YQPv6yG kVEzlxW8cv9wgQAQ== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id 1Hw8Dm8wymDdMgAALh3uQQ (envelope-from ); Wed, 16 Jun 2021 17:10:07 +0000 To: Janghyuck Kim Cc: Catalin Marinas , Will Deacon , Andrew Morton , Palmer Dabbelt , Atish Patra , Gavin Shan , Zhengyuan Liu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20210616083745.14288-1-janghyuck.kim@samsung.com> From: Vlastimil Babka Subject: Re: [PATCH 1/2] mm: support fastpath if NUMA is enabled with numa off Message-ID: <55a95320-f356-86d2-26e4-11407f60de84@suse.cz> Date: Wed, 16 Jun 2021 19:10:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210616083745.14288-1-janghyuck.kim@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 4592CE0004C0 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=mriEgvvv; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=s76ZnqiB; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=mriEgvvv; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=s76ZnqiB; spf=pass (imf13.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Stat-Signature: oifpq9s6yypj1r73pmqwyttdojp88pgx X-HE-Tag: 1623863400-942488 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 6/16/21 10:37 AM, Janghyuck Kim wrote: > Architecture might support fake node when CONFIG_NUMA is enabled but an= y I suppose you mean the dummy node, i.e. dummy_numa_init()? Because fakenuma is something different and I think if someone defines fa= kenuma nodes they actually would want for the mempolicies to be honored as if th= ere was a real NUMA setup. > node settings were supported by ACPI or device tree. In this case, > getting memory policy during memory allocation path is meaningless. >=20 > Moreover, performance degradation was observed in the minor page fault > test, which is provided by (https://lkml.org/lkml/2006/8/29/294). > Average faults/sec of enabling NUMA with fake node was 5~6 % worse than > disabling NUMA. To reduce this performance regression, fastpath is So you have measured this overhead is all due to mempolicy evaluation? Interesting, sounds like a lot. > introduced. fastpath can skip the memory policy checking if NUMA is > enabled but it uses fake node. If architecture doesn't support fake > node, fastpath affects nothing for memory allocation path. >=20 > Signed-off-by: Janghyuck Kim Sounds like an interesting direction to improve CONFIG_NUMA built kernels= on single-node systems, but why restrict it only to arm64 and not make it ge= neric for all systems with a single node? We could also probably use a static key instead of this #define. That would even make it possible to switch in case memory hotplug onlines another node, etc. > --- > mm/internal.h | 4 ++++ > mm/mempolicy.c | 3 +++ > 2 files changed, 7 insertions(+) >=20 > diff --git a/mm/internal.h b/mm/internal.h > index 31ff935b2547..3b6c21814fbc 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -36,6 +36,10 @@ void page_writeback_init(void); > =20 > vm_fault_t do_swap_page(struct vm_fault *vmf); > =20 > +#ifndef numa_off_fastpath > +#define numa_off_fastpath() false > +#endif > + > void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *star= t_vma, > unsigned long floor, unsigned long ceiling); > =20 > diff --git a/mm/mempolicy.c b/mm/mempolicy.c > index e32360e90274..21156671d941 100644 > --- a/mm/mempolicy.c > +++ b/mm/mempolicy.c > @@ -2152,6 +2152,9 @@ struct page *alloc_pages_vma(gfp_t gfp, int order= , struct vm_area_struct *vma, > int preferred_nid; > nodemask_t *nmask; > =20 > + if (numa_off_fastpath()) > + return __alloc_pages_nodemask(gfp, order, 0, NULL); > + > pol =3D get_vma_policy(vma, addr); > =20 > if (pol->mode =3D=3D MPOL_INTERLEAVE) { >=20