Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2227089ybh; Fri, 24 Jul 2020 07:34:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgIq0HDSuEGNtV54R2b4rods1Gflmuy/n/5fRk/cWHjadluE19cvzeHydQ9nq+n2wd0baj X-Received: by 2002:a17:906:4a87:: with SMTP id x7mr9844677eju.44.1595601291709; Fri, 24 Jul 2020 07:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595601291; cv=none; d=google.com; s=arc-20160816; b=PsWgrSSO2+o0nXnoO6Q1YsN2LMkQDpuk6mtBe5BRgV3AbjXMTZTyy/IH28wNpaBXdl 5dFJfaa+pwF/IVA2doJvgu/KD7EQKye060g/40+zIC3ZjiebdUSokRy4zTNO9HIwiVmF ss+IFJTZSVbAdjMnePpyoacERMTjmIdQFS2kow59gId3sYDOVUaW6E3Kp3SydMjSIzDb RAJKaASJ3hMUgqas8MulS0BrHegfXTGkBdwCL1g0x5wFAMnCsqEVczf9DyeJg5ZUTgP+ fY6x6F+GQypxlrAxMK5Hy9ebY1jssKUnKyKb6d/sIFYZdaqpZwp/jSk4KEv646kZqRLt triA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=WPCbEiFSIjdEuqkYFjfywOItguV+cZ16q7TwHZmL0G0=; b=e0bqGJ3d7NT5H4Iq9ggCmYGmRRrSWCI7GWoj+uQAHJFTCYaxE3BDIvCxbIWErNfGsQ EruD5kyGzby7ePRO5GocuvUd2Mi/X3z1RyRI7gB8tcH+K/Z+f9jCQEUK70slxmlOKTm4 d69JUMOxGjy2dHpmLn050dQp/p5mESjNmQSgiLvzjyJR4/Au7nmDNvC5nd/uBr/xPg9F vfR3WW3MCBOm5TLWuVaot+0rA/59kqTDNqIGuDC8/kH84X+Lh/PiByg9pxIWpOi1/1pg zgNeTriDx6EpzvNWuvfb4pfnUsqnfvdY7KhPk4Fp5VvNrYEEmXNFAu2jlNgRf3XutrAO ZEbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si603514edj.525.2020.07.24.07.34.29; Fri, 24 Jul 2020 07:34:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726854AbgGXOdE (ORCPT + 99 others); Fri, 24 Jul 2020 10:33:04 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:63538 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726643AbgGXOdE (ORCPT ); Fri, 24 Jul 2020 10:33:04 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06OEV87K120301; Fri, 24 Jul 2020 10:33:02 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 32fat2xauf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Jul 2020 10:33:01 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06OEVD4K120896; Fri, 24 Jul 2020 10:33:01 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 32fat2xaru-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Jul 2020 10:33:01 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06OEUX0I029871; Fri, 24 Jul 2020 14:32:56 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03fra.de.ibm.com with ESMTP id 32brq842uj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Jul 2020 14:32:56 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06OEVR6w34734474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jul 2020 14:31:27 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 24D80A4053; Fri, 24 Jul 2020 14:32:52 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CB2EEA4059; Fri, 24 Jul 2020 14:32:51 +0000 (GMT) Received: from osiris (unknown [9.171.73.247]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 24 Jul 2020 14:32:51 +0000 (GMT) Date: Fri, 24 Jul 2020 16:32:50 +0200 From: Heiko Carstens To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-mm@kvack.org, Christian Borntraeger , Gerald Schaefer , Vasily Gorbik Subject: Re: [PATCH v2 0/9] s390: implement and optimize vmemmap_free() Message-ID: <20200724143250.GB4063@osiris> References: <20200722094558.9828-1-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200722094558.9828-1-david@redhat.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-24_04:2020-07-24,2020-07-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 phishscore=0 adultscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 mlxlogscore=906 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007240108 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 22, 2020 at 11:45:49AM +0200, David Hildenbrand wrote: > 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) == 56). > > vmemmap_free() is currently never used, unless adiing standby memory fails > (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 share > 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/freed > 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=features > > 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(-) Series applied, thank you!