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 Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE622C32771 for ; Mon, 26 Sep 2022 15:27:08 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Mbmp33dBfz3c9p for ; Tue, 27 Sep 2022 01:27:07 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Fy7DqcTQ; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Fy7DqcTQ; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=david@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Fy7DqcTQ; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Fy7DqcTQ; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 lists.ozlabs.org (Postfix) with ESMTPS id 4MbmnQ1ggGz2xZ4 for ; Tue, 27 Sep 2022 01:26:32 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664205988; 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=YcUAoJPx/293KJLL46ZZ2kLyCO3l5xX7bQLDqEviC+8=; b=Fy7DqcTQrCYJ5NBXmQ59D80r2K5EmU36Z94wvSkQaPnQLEcU2Q5bnQwYGZOo2BMyxo+RMV iOuvRyKvZ1BvOiAVJQd0I3HaOuXk/60TpAxZP9yT7GWUlrcfFSlBkBvW7fftImZnqRcuiG mpgP24AkQe3H4kby+z963u8HhtQH/ps= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664205988; 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=YcUAoJPx/293KJLL46ZZ2kLyCO3l5xX7bQLDqEviC+8=; b=Fy7DqcTQrCYJ5NBXmQ59D80r2K5EmU36Z94wvSkQaPnQLEcU2Q5bnQwYGZOo2BMyxo+RMV iOuvRyKvZ1BvOiAVJQd0I3HaOuXk/60TpAxZP9yT7GWUlrcfFSlBkBvW7fftImZnqRcuiG mpgP24AkQe3H4kby+z963u8HhtQH/ps= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-86-vIy5ixN0PjmWNTQVGUCBmg-1; Mon, 26 Sep 2022 11:26:24 -0400 X-MC-Unique: vIy5ixN0PjmWNTQVGUCBmg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C8541858F13; Mon, 26 Sep 2022 15:26:23 +0000 (UTC) Received: from t480s.fritz.box (unknown [10.39.193.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBAFDC15BA5; Mon, 26 Sep 2022 15:26:19 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Subject: [PATCH RFC 0/5] mm/autonuma: replace savedwrite infrastructure Date: Mon, 26 Sep 2022 17:26:13 +0200 Message-Id: <20220926152618.194810-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrea Arcangeli , David Hildenbrand , linuxppc-dev@lists.ozlabs.org, Anshuman Khandual , Dave Chinner , Mel Gorman , Peter Xu , linux-mm@kvack.org, Hugh Dickins , Nadav Amit , Nicholas Piggin , Mike Rapoport , Andrew Morton , Linus Torvalds , Vlastimil Babka Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" As discussed in my talk at LPC, we can reuse the same mechanism for deciding whether to map a pte writable when upgrading permissions via mprotect() -- e.g., PROT_READ -> PROT_READ|PROT_WRITE -- to replace the savedwrite infrastructure used for NUMA hinting faults (e.g., PROT_NONE -> PROT_READ|PROT_WRITE). Instead of maintaining previous write permissions for a pte/pmd, we re-determine if the pte/pmd can be writable. The big benefit is that we have a common logic for deciding whether we can map a pte/pmd writable on protection changes. For private mappings, there should be no difference -- from what I understand, that is what autonuma benchmarks care about. I ran autonumabench on a system with 2 NUMA nodes, 96 GiB each via: perf stat --null --repeat 10 The numa1 benchmark is quite noisy in my environment. I suspect that there is no actual change in performance, even though the numbers indicate that this series might improve performance slightly. numa1: mm-stable: 156.75 +- 11.67 seconds time elapsed ( +- 7.44% ) mm-stable++: 147.50 +- 9.35 seconds time elapsed ( +- 6.34% ) numa2: mm-stable: 15.9834 +- 0.0589 seconds time elapsed ( +- 0.37% ) mm-stable++: 16.1467 +- 0.0946 seconds time elapsed ( +- 0.59% ) It is worth noting that for shared writable mappings that require writenotify, we will only avoid write faults if the pte/pmd is dirty (inherited from the older mprotect logic). If we ever care about optimizing that further, we'd need a different mechanism to identify whether the FS still needs to get notified on the next write access. In any case, such an optimiztion will then not be autonuma-specific, but mprotect() permission upgrades would similarly benefit from it. Cc: Linus Torvalds Cc: Andrew Morton Cc: Mel Gorman Cc: Dave Chinner Cc: Nadav Amit Cc: Peter Xu Cc: Andrea Arcangeli Cc: Hugh Dickins Cc: Vlastimil Babka Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Mike Rapoport Cc: Anshuman Khandual David Hildenbrand (4): mm/mprotect: minor can_change_pte_writable() cleanups mm/huge_memory: try avoiding write faults when changing PMD protection mm/autonuma: use can_change_(pte|pmd)_writable() to replace savedwrite mm: remove unused savedwrite infrastructure Nadav Amit (1): mm/mprotect: allow clean exclusive anon pages to be writable arch/powerpc/include/asm/book3s/64/pgtable.h | 80 +------------------- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 2 +- include/linux/mm.h | 2 + include/linux/pgtable.h | 24 ------ mm/debug_vm_pgtable.c | 32 -------- mm/huge_memory.c | 66 ++++++++++++---- mm/ksm.c | 9 +-- mm/memory.c | 19 ++++- mm/mprotect.c | 23 +++--- 9 files changed, 93 insertions(+), 164 deletions(-) -- 2.37.3