Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1034149pxf; Thu, 11 Mar 2021 23:37:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxChcOGH3U8LmgAkc525BVrKpRJyNYGHQNZaps5Ay+gjzjxqUe4gEehqt1TmAYIV5tmbyLc X-Received: by 2002:a50:d71e:: with SMTP id t30mr12528715edi.58.1615534652983; Thu, 11 Mar 2021 23:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615534652; cv=none; d=google.com; s=arc-20160816; b=PoF9XBIkbTHhGeGVQYQ+eJDWiC6AuyfC0TjHs4f6mw1D1TM1yOwFvhigvnh7PXxxUo Aao2UmwpbFrf9Y/+QbYLyb+XNNRaIIVRundXl4ia5BLSzijMq2obhmQb+YQh39SkQ7Jy CxQSLQtH3/OIJhsCMi4B1jeVyR4vXuhoDl51kS+zvbLK5X3Cge98zZp/JhYuL7zTkmSY 6dEVmAaJehuzZB5hbJG4pfOzNfRP9GIyprAmRQUhJFPjTVkoJjMlPE0YCPy/e4kj7KFB wahBCboeBJ27v3yJojyh4o16b/Zuuevyi+y/54jxUl5Ivk+3RU4x/oGPh91zJg7FPzhr ENDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=wTTL3epqLr8n/6ho+8HvrvB50DNSmJF+IOAwdRQ37Jw=; b=KQ71FqJm3pc5l1PdRSO5V7ZUIE2QSaDf9Flsf4Pxmg4M3D3sx7DR4Ikz/ghw4SB+Wd 2M9PrJD1+fAnCIs8G1WZG3QWOx5nYN8MkXUvWof3RlGFEaCsPpV0wdnlcwJnlHSW3GYO MNd6kIQ4zfzBgg3gsbxs5whpoPnazWri5O26THHehROJp2CFhSuHrPhwMH3L1Mii30Vh 5RIG7xHFoETHlLePrTfS6bSDwXr1e6OHr/ogTx5cNNVtTNkelCos2cY6H+/h6t9HPzgH dg6GTA+HI60uEZkOkm2AAWkhQRseTJJU47VlFZh/WeekmRIBV33QJr/sgbpvz57W0YL1 vQtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U1Aax+Gx; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a7si3918260edb.607.2021.03.11.23.37.10; Thu, 11 Mar 2021 23:37:32 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U1Aax+Gx; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231597AbhCLHbx (ORCPT + 99 others); Fri, 12 Mar 2021 02:31:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231636AbhCLHbo (ORCPT ); Fri, 12 Mar 2021 02:31:44 -0500 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 058ACC061574 for ; Thu, 11 Mar 2021 23:31:44 -0800 (PST) Received: by mail-qt1-x82f.google.com with SMTP id f12so3114266qtq.4 for ; Thu, 11 Mar 2021 23:31:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wTTL3epqLr8n/6ho+8HvrvB50DNSmJF+IOAwdRQ37Jw=; b=U1Aax+GxxM2k71AkvU4mXJXmXQk/7ENUFn9AAmEijKBQ1GuuDiSmPOAjF2KqEdZTTP ivX3CWgyOEzMYN0Vo3SVkfvwhhfgVRonJWO2FLLBQFldQBCSEtWbufV5nFeCMhlbh+u3 yq5f/5KAjtchym0M0Z9H8bwXFhBI4C0QbRYY9lxC2g1vaemG2av+dBiM+cNw9NX8kIR9 e6UhwhPasOK/N3Nhs/vvE4rN8XKVBUrGiZmZ9vgkwgYzSkeYSB2T35oWNoqWk2CETPef 4Kd/YlbXEM744cv8GSEyknAd6BEFZJacr6NK0TwLntGLGLTguy5fqJvkHxpvazVoZ8hO 7OEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wTTL3epqLr8n/6ho+8HvrvB50DNSmJF+IOAwdRQ37Jw=; b=CrvwrGLYykkgP9VdqHanFE8ddIM//sfC4C84WWTwUZC2xAjvjwDuS8CNVEJ+vYwfDV Clj246RGqtmsh3O6NlcuF0UPPCuLhETWyS7UhvDx4MnhuGpGV0RHxMp+TK/rpNp1ZTn+ l9DW0m/YKQIQA1vwSlo4XWR2xRuNZgzvPRdxtGxnMmUpJeLnQnyCJ+c4gu509zNb/qqb wH9zoz5IPh4KAP7t43+YlmimV3WJ+k7EQU5LCgmdDJV9w+JPlzvg0CMKC1pjRwRT2HoW Pxe+SxephIEdHDW2/VCC/C2GhguusqwEn8MUJ6PvbGqB57kSv3ruMIAJGeYuysYVDWUd 10CA== X-Gm-Message-State: AOAM530/wAx0xx/S9jgP4ewozu7VOf5Vzgx2VM7gACvLSXh9jMd9EeBV NnAhBxFvuUxT8jPJk+ix2jI= X-Received: by 2002:ac8:4543:: with SMTP id z3mr10845208qtn.286.1615534303274; Thu, 11 Mar 2021 23:31:43 -0800 (PST) Received: from li-908e0a4c-2250-11b2-a85c-f027e903211b.ibm.com.com (177-131-89-8.dynamic.desktop.com.br. [177.131.89.8]) by smtp.gmail.com with ESMTPSA id t6sm3434026qti.2.2021.03.11.23.31.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 23:31:42 -0800 (PST) From: Leonardo Bras To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Andrew Morton , Leonardo Bras , Sandipan Das , "Aneesh Kumar K.V" , Logan Gunthorpe , Mike Rapoport , Bharata B Rao , Dan Williams , Nicholas Piggin , Nathan Lynch , David Hildenbrand , Laurent Dufour , Scott Cheloha , David Gibson Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/3] powerpc/mm/hash: Time improvements for memory hot(un)plug Date: Fri, 12 Mar 2021 04:29:38 -0300 Message-Id: <20210312072940.598696-1-leobras.c@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset intends to reduce time needed for processing memory hotplug/hotunplug in hash guests. The first one, makes sure guests with pagesize over 4k don't need to go through HPT resize-downs after memory hotplug. The second and third patches make hotplug / hotunplug perform a single HPT resize per operation, instead of one for each shift change, or one for each LMB in case of resize-down error. Why haven't the same mechanism used for both memory hotplug and hotunplug? They both have different requirements: Memory hotplug causes (usually) HPT resize-ups, which are fine happening at the start of hotplug, but resize-ups should not ever be disabled, as other mechanisms may try to increase memory, hitting issues with a HPT that is too small. Memory hotunplug causes HPT resize-downs, which can be disabled (HPT will just remain larger for a while), but need to happen at the end of an hotunplug operation. If we want to batch it, we need to disable resize-downs and perform it only at the end. Tests done with this patchset in the same machine / guest config: Starting memory: 129GB, DIMM: 256GB Before patchset: hotplug = 710s, hotunplug = 621s. After patchset: hotplug = 21s, hotunplug = 100s. Any feedback will be appreciated! I believe the code may not be very well placed in available files, so please give some feedback on that. Best regards, Leonardo Bras (3): powerpc/mm/hash: Avoid resizing-down HPT on first memory hotplug powerpc/mm/hash: Avoid multiple HPT resize-ups on memory hotplug powerpc/mm/hash: Avoid multiple HPT resize-downs on memory hotunplug arch/powerpc/include/asm/book3s/64/hash.h | 4 + arch/powerpc/include/asm/sparsemem.h | 4 + arch/powerpc/mm/book3s64/hash_utils.c | 78 +++++++++++++++---- arch/powerpc/mm/book3s64/pgtable.c | 18 +++++ .../platforms/pseries/hotplug-memory.c | 22 ++++++ 5 files changed, 111 insertions(+), 15 deletions(-) -- 2.29.2