From patchwork Wed Jun 2 18:57:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 12295541 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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 D5141C47083 for ; Wed, 2 Jun 2021 18:57:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 64616613E6 for ; Wed, 2 Jun 2021 18:57:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64616613E6 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 AC50B6B0036; Wed, 2 Jun 2021 14:57:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A751F6B006C; Wed, 2 Jun 2021 14:57:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EF4E6B0070; Wed, 2 Jun 2021 14:57:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0253.hostedemail.com [216.40.44.253]) by kanga.kvack.org (Postfix) with ESMTP id 592CD6B0036 for ; Wed, 2 Jun 2021 14:57:36 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id F25AB8249980 for ; Wed, 2 Jun 2021 18:57:35 +0000 (UTC) X-FDA: 78209692470.07.8654DB5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf03.hostedemail.com (Postfix) with ESMTP id 3CCFAC00CBF4 for ; Wed, 2 Jun 2021 18:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622660255; 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=y6MOJkXDqthwxgoOtIfGa8m4Pzox6wAw262/GSt7ITY=; b=N9l+5WpKcsGt2SunNAd8IeX6ZmZ9PXERKcCNS74BRzaA0SsHvr4GXHRFENNE5VbCTcYwBm lGkKeNYFpt0ILoUFSLcK1W+4ytOqoLAznKUObiUasThWcrOE7Fzn0gJi2Oy0/wLx3uc3DP LdK6hxUd+Y474/8XLNgNCBqL+yQoVko= 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-412-anCrELXmM4icLUzhQDGNjg-1; Wed, 02 Jun 2021 14:57:33 -0400 X-MC-Unique: anCrELXmM4icLUzhQDGNjg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A579107ACC7; Wed, 2 Jun 2021 18:57:32 +0000 (UTC) Received: from t480s.redhat.com (ovpn-114-159.ams2.redhat.com [10.36.114.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7BC0100238C; Wed, 2 Jun 2021 18:57:21 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: David Hildenbrand , "Michael S. Tsirkin" , Jason Wang , Marek Kedzierski , Hui Zhu , Pankaj Gupta , Wei Yang , Oscar Salvador , Michal Hocko , virtualization@lists.linux-foundation.org, linux-mm@kvack.org Subject: [PATCH v1 0/7] virtio-mem: prioritize unplug from ZONE_MOVABLE Date: Wed, 2 Jun 2021 20:57:13 +0200 Message-Id: <20210602185720.31821-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=N9l+5WpK; spf=none (imf03.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 3CCFAC00CBF4 X-Stat-Signature: bcp9pdrikhwqcmo45ohri58qtty88k4m X-HE-Tag: 1622660242-639593 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: Until now, memory provided by a single virtio-mem device was usually either onlined completely to ZONE_MOVABLE (online_movable) or to ZONE_NORMAL (online_kernel), so we didn't actually care about "what" we are unplugging; however, that will change in the future when we will have memory blocks in different zones within a single virtio-mem device. There are two reasons why we want to track to which zone a memory block belongs to and prioritize ZONE_MOVABLE blocks: 1) Memory managed by ZONE_MOVABLE can more likely get unplugged, therefore, resulting in a faster memory hotunplug process. Further, we can more reliably unplug and remove complete memory blocks, removing metadata allocated for the whole memory block. 2) We want to avoid corner cases where unplugging with the current scheme (highest to lowest address) could result in accidential zone imbalances, whereby we remove too much ZONE_NORMAL memory for ZONE_MOVABLE memory of the same device. This series unplugs ZONE_MOVABLE memory blocks first, before falling back to ZONE_NORMAL ones. Patch #1 is an unrelated fix, previously sent in other context that didn't get picked up yet. Patch #2-#4 and #6 are cleanups. Patch #5 and #7 implement ZONE_MOVABLE aware handling in Sub Block Mode and Big Block Mode respectively. Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Marek Kedzierski Cc: Hui Zhu Cc: Pankaj Gupta Cc: Wei Yang Cc: Oscar Salvador Cc: Michal Hocko Cc: virtualization@lists.linux-foundation.org Cc: linux-mm@kvack.org David Hildenbrand (7): virtio-mem: don't read big block size in Sub Block Mode virtio-mem: use page_zonenum() in virtio_mem_fake_offline() virtio-mem: simplify high-level plug handling in Sub Block Mode virtio-mem: simplify high-level unplug handling in Sub Block Mode virtio-mem: prioritize unplug from ZONE_MOVABLE in Sub Block Mode virtio-mem: simplify high-level unplug handling in Big Block Mode virtio-mem: prioritize unplug from ZONE_MOVABLE in Big Block Mode drivers/virtio/virtio_mem.c | 338 +++++++++++++++++++----------------- 1 file changed, 174 insertions(+), 164 deletions(-) base-commit: 8124c8a6b35386f73523d27eacb71b5364a68c4c