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=-8.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 42A93C433E8 for ; Wed, 22 Jul 2020 09:46:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 044712068F for ; Wed, 22 Jul 2020 09:46:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Z+s/gak5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 044712068F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 90B4A6B0005; Wed, 22 Jul 2020 05:46:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E3796B0006; Wed, 22 Jul 2020 05:46:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F86B6B0007; Wed, 22 Jul 2020 05:46:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0173.hostedemail.com [216.40.44.173]) by kanga.kvack.org (Postfix) with ESMTP id 6FEE56B0005 for ; Wed, 22 Jul 2020 05:46:09 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2E53318A4386E for ; Wed, 22 Jul 2020 09:46:09 +0000 (UTC) X-FDA: 77065230858.04.smell04_41038bb26f35 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 06D4A187D9594 for ; Wed, 22 Jul 2020 09:46:09 +0000 (UTC) X-HE-Tag: smell04_41038bb26f35 X-Filterd-Recvd-Size: 4574 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Wed, 22 Jul 2020 09:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595411167; 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; bh=MBPzayyDDaE0GAZE66kREJVgIDaMwKB4hXq7u7LMzPg=; b=Z+s/gak5nr++Mb3aQQ8Mw5ID/fVDGliMTHMyqMGPgvkG34AIdz+5GzsJkzeqaoZ2JGgbPf OBPdZNh7R2Z1liZ8jHhpa2Zi/GFqlnnc5clOylywdqITLJXUiCYCDgPYBH8oKtsoKv6L7H JphcPPRicOtMXJNHJcD8/yCY56aZunI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-447-Qbgut7EmOUKmHE08V_x4SA-1; Wed, 22 Jul 2020 05:46:05 -0400 X-MC-Unique: Qbgut7EmOUKmHE08V_x4SA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F13CE100CCC0; Wed, 22 Jul 2020 09:46:03 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-254.ams2.redhat.com [10.36.113.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79D355D9DC; Wed, 22 Jul 2020 09:45:59 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-s390@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Christian Borntraeger , Gerald Schaefer , Heiko Carstens , Vasily Gorbik Subject: [PATCH v2 0/9] s390: implement and optimize vmemmap_free() Date: Wed, 22 Jul 2020 11:45:49 +0200 Message-Id: <20200722094558.9828-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Rspamd-Queue-Id: 06D4A187D9594 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: This series is based on the latest s390/features branch [1]. It consolidates vmem_add_range(), vmem_remove_range(), and vmemmap_populate(= ) into a single, recursive page table walker. It then implements vmemmap_free() and optimizes it by - Freeing empty page tables (also done for vmem_remove_range()). - Handling cases where the vmemmap of a section does not fill huge pages completely (e.g., sizeof(struct page) =3D=3D 56). vmemmap_free() is currently never used, unless adiing standby memory fail= s (unlikely). This is relevant for virtio-mem, which adds/removes memory in memory block/section granularity (always removes memory in the same granularity it added it). I gave this a proper test with my virtio-mem prototype (which I will shar= e in the near future), both with 56 byte memmap per page and 64 byte memmap per page, with and without huge page support. In both cases, removing memory (routed through arch_remove_memory()) will result in - all populated vmemmap pages to get removed/freed - all applicable page tables for the vmemmap getting removed/freed - all applicable page tables for the idendity mapping getting removed/fre= ed Unfortunately, I don't have access to bigger and z/VM (esp. dcss) environments. This is the basis for real memory hotunplug support for s390x and should complete my journey to s390x vmem/vmemmap code for now What needs double-checking is tlb flushing. AFAIKS, as there are no valid accesses, doing a single range flush at the end is sufficient, both when removing vmemmap pages and the idendity mapping. [1] https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git/commit= /?h=3Dfeatures v1 -> v2: - Convert to a single page table walker named "modify_pagetable()", with two helper functions "add_pagetable()" and "remove_pagetable(). David Hildenbrand (9): s390/vmem: rename vmem_add_mem() to vmem_add_range() s390/vmem: consolidate vmem_add_range() and vmem_remove_range() s390/vmemmap: extend modify_pagetable() to handle vmemmap s390/vmemmap: cleanup when vmemmap_populate() fails s390/vmemmap: take the vmem_mutex when populating/freeing s390/vmem: cleanup empty page tables s390/vmemmap: fallback to PTEs if mapping large PMD fails s390/vmemmap: remember unused sub-pmd ranges s390/vmemmap: avoid memset(PAGE_UNUSED) when adding consecutive sections arch/s390/mm/vmem.c | 637 ++++++++++++++++++++++++++++++-------------- 1 file changed, 442 insertions(+), 195 deletions(-) --=20 2.26.2