From patchwork Mon Oct 14 14:46:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13835162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B264D16279 for ; Mon, 14 Oct 2024 14:47:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 989C06B009D; Mon, 14 Oct 2024 10:47:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9129D6B009E; Mon, 14 Oct 2024 10:47:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78CAC6B009F; Mon, 14 Oct 2024 10:47:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 550B86B009D for ; Mon, 14 Oct 2024 10:47:33 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3ADD841033 for ; Mon, 14 Oct 2024 14:47:28 +0000 (UTC) X-FDA: 82672486218.05.9C1BA64 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf18.hostedemail.com (Postfix) with ESMTP id C503B1C0005 for ; Mon, 14 Oct 2024 14:47:28 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Xcgtso2C; spf=pass (imf18.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728917110; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3vLbVvz73tLbmbnaPx4ieOXFlBDH6z0eEi0A+B6nUW0=; b=vf0h+5tggb2oCdYTTqzn42cLDEn5hToI4AnFyWzPKMQMgXMfH6W8p1Aw+4wMaFkiBc2QOF EHD+M1wKA81EGfyeHMA3BP+qBMgcGwJ3Gzeq5Mb1Gl0ndOSVuACKjGSSAC5APzkA17eLXG VrD2lN3n6F42MfrIJal6z9TwBdGgdgc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728917110; a=rsa-sha256; cv=none; b=iR2xokNT60USS71noYFlT7oxPkoykYjMwEfXyuQeSyJ0mhfHcQBpcJSuGnTXft5FkuSrJh hv82KyiWXAtJ0IMfc884/w7R/sXn1l/sPAb/3QoCRIBM8u6v98x4/HozNiYh5ndFiUJnL+ NvbwkzD8/WN8bJsTlclCoPUjfCD0VFM= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Xcgtso2C; spf=pass (imf18.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728917250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3vLbVvz73tLbmbnaPx4ieOXFlBDH6z0eEi0A+B6nUW0=; b=Xcgtso2CPr3HpKcRZ0gM0ztTPXozzLlgCR3ZOYTfjVjcl/6gfmsj1ZTvsMDNCvSKMOQ5Mn FTq5TCRuB4FHMjBTZ8WG79tLodF+cZ4lAIRcrp9xlCcOgPnpNVGdtgcDypMd8TRBRpz625 taOPGWG/3TLuJC2bhKIm6Af4+Vrvq7o= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-589-8KXKzAUyOoGjGD-HwYImmg-1; Mon, 14 Oct 2024 10:47:27 -0400 X-MC-Unique: 8KXKzAUyOoGjGD-HwYImmg-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7F38F1955F07; Mon, 14 Oct 2024 14:47:25 +0000 (UTC) Received: from t14s.cit.tum.de (unknown [10.22.32.146]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F09031955E8F; Mon, 14 Oct 2024 14:47:17 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, linux-doc@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Andrew Morton , Jonathan Corbet , Mario Casquero Subject: [PATCH v2 7/7] s390/sparsemem: reduce section size to 128 MiB Date: Mon, 14 Oct 2024 16:46:19 +0200 Message-ID: <20241014144622.876731-8-david@redhat.com> In-Reply-To: <20241014144622.876731-1-david@redhat.com> References: <20241014144622.876731-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Queue-Id: C503B1C0005 X-Stat-Signature: 3fq1cfhytw5yow4pxjrm7fx1efopda13 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1728917248-887320 X-HE-Meta: U2FsdGVkX19AIlCS09QEpbjHGURH1qc8AHOTDFEkNkJZALmUzO6hra5y1/wIK/o2jGgO/GIDmHMDDASb4zJUARAE8YpRGpNzfAALVboOjvsPYrnUluvGHqG/Cg1NgHXIAPjqXnkwVFSCEwu6M+GMwyZJiABZJRIM6EEONdHvw3LYhcIDQPugRLMtNylr/GKFHivK2Z4qN2hwEbJHK1T9Dl6y3Tv+Ma6MXRvvSmctiNVfpKFSdEwjUUjPxnHrg3Aek9lSxPVUBvXs5k/1vta8xGaNrW1XV31YKm+zMeB05iJPUb/od+IWqxTW1ZfcN02DuAakTSf0NHppeRNbtkgM1iPRUPRkqlBQE+CYrETRGSJPAYWtTLcgsVuMj4blsIvRNSiSkSbZm5lB5kaAijJMRogYLQRtzBrrqqwx62T1szLsuzjW+v3yRuv4s7tDCXamV5QfnhHJDeQDF5yxHR1e1jo6yEBbIurmI3AtZA3hmGhVr8KuZ9JR0KgVwEvAJ/LjyuJNeNZfhlIfdBz6A3+I8vdftwMa9rAk5Ul6/p8NBx0wcnJ5sfGfUBT3AQniWTsw4/T1flXg7kZlw/gau1ULDVBDcAF2mk93PLfAvjf7yPQwQkeWMx7azyx4W00nCgs+6802Px/TCq7TIMi59kb3YBACzHb+RodPfaEj/zlxXXyppSR/O2d52ZNDz5US1BBCJ3Ut+uw+N7yX/ratkVv1+k+qYs85ah0qpRUjgiWbOBHVcKjH/JSq8RyyGuNekpQjParCaVvD4Dm/XZSwzyLkMerauTEukzNAqfGZyauQ1oX7q9TdOcwMADM56LBjrr/150Idp+3SFYgaHtgB3K26YezkjMLDJr5dRZz7P9MBZuKLYyJHCQH4wV9yaE/P/0Ml4BSFzLHQFsNqsixBHTeC7ZPjLRPe9O7oSrXoMR/UxQsVTXJG0OFyNzadjahb983LdNrGLvj8GVmfO1N/uYt JhOt5Sne AbMmBzqgkESxFQSIxkM2O74gMiWn23t3PuorfMmEr1Y7OO8QlQxjQcHJVtwhHIbJp0/iEVhBpILHdvEw2yxzxcYC82M25SRYSnWUDXyYJP/Ee+LtvS1fMTG6rkxeBhDs5aHW5Bi2dwSePFhFX4rzzvpwoZ/5kSQb7rz6bYIWEvzlT4YDUP9cSk6OnLsHhu/dwlQJ3mPYo7MpBcTw9R7QsBXZuxk6bnzITrWLs7c0P828zSH1fH7rV2hOjY/DYSWzj8MlPqhU7FEgD6eN8MV6AS3Cce/wskxbKOncwg430nk2DSDZ5KpfZRckqd0N6IzVD0SIgyOpjxMOteFA= 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: List-Subscribe: List-Unsubscribe: Ever since commit 421c175c4d609 ("[S390] Add support for memory hot-add.") we've been using a section size of 256 MiB on s390 and 32 MiB on s390. Before that, we were using a section size of 32 MiB on both architectures. Likely the reason was that we'd expect a storage increment size of 256 MiB under z/VM back then. As we didn't support memory blocks spanning multiple memory sections, we would have had to handle having multiple memory blocks for a single storage increment, which complicates things. Although that issue reappeared with even bigger storage increment sizes later, nowadays we have memory blocks that can span multiple memory sections and we avoid any such issue completely. Now that we have a new mechanism to expose additional memory to a VM -- virtio-mem -- reduce the section size to 128 MiB to allow for more flexibility and reduce the metadata overhead when dealing with hot(un)plug granularity smaller than 256 MiB. 128 MiB has been used by x86-64 since the very beginning. arm64 with 4k base pages switched to 128 MiB as well: it's just big enough on these architectures to allows for using a huge page (2 MiB) in the vmemmap in sane setups with sizeof(struct page) == 64 bytes and a huge page mapping in the direct mapping, while still allowing for small hot(un)plug granularity. For s390, we could even switch to a 64 MiB section size, as our huge page size is 1 MiB: but the smaller the section size, the more sections we'll have to manage especially on bigger machines. Making it consistent with x86-64 and arm64 feels like te right thing for now. Note that the smallest memory hot(un)plug granularity is also limited by the memory block size, determined by extracting the memory increment size from SCLP. Under QEMU/KVM, implementing virtio-mem, we expose 0; therefore, we'll end up with a memory block size of 128 MiB with a 128 MiB section size. Tested-by: Mario Casquero Signed-off-by: David Hildenbrand Acked-by: Heiko Carstens --- arch/s390/include/asm/sparsemem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/include/asm/sparsemem.h b/arch/s390/include/asm/sparsemem.h index c549893602ea..ff628c50afac 100644 --- a/arch/s390/include/asm/sparsemem.h +++ b/arch/s390/include/asm/sparsemem.h @@ -2,7 +2,7 @@ #ifndef _ASM_S390_SPARSEMEM_H #define _ASM_S390_SPARSEMEM_H -#define SECTION_SIZE_BITS 28 +#define SECTION_SIZE_BITS 27 #define MAX_PHYSMEM_BITS CONFIG_MAX_PHYSMEM_BITS #endif /* _ASM_S390_SPARSEMEM_H */