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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 340E1C04E69 for ; Wed, 2 Aug 2023 15:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235245AbjHBP3c (ORCPT ); Wed, 2 Aug 2023 11:29:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235084AbjHBP3P (ORCPT ); Wed, 2 Aug 2023 11:29:15 -0400 Received: from outbound-smtp48.blacknight.com (outbound-smtp48.blacknight.com [46.22.136.219]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E8FE30CA for ; Wed, 2 Aug 2023 08:27:05 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp48.blacknight.com (Postfix) with ESMTPS id 49778FAE4F for ; Wed, 2 Aug 2023 16:27:04 +0100 (IST) Received: (qmail 2300 invoked from network); 2 Aug 2023 15:27:04 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.20.191]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 2 Aug 2023 15:27:04 -0000 Date: Wed, 2 Aug 2023 16:27:02 +0100 From: Mel Gorman To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, Andrew Morton , Linus Torvalds , liubo , Peter Xu , Matthew Wilcox , Hugh Dickins , Jason Gunthorpe , John Hubbard , Mel Gorman , Shuah Khan , Paolo Bonzini Subject: Re: [PATCH v2 3/8] kvm: explicitly set FOLL_HONOR_NUMA_FAULT in hva_to_pfn_slow() Message-ID: <20230802152702.wamtroy3zm7nbtvs@techsingularity.net> References: <20230801124844.278698-1-david@redhat.com> <20230801124844.278698-4-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20230801124844.278698-4-david@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 01, 2023 at 02:48:39PM +0200, David Hildenbrand wrote: > KVM is *the* case we know that really wants to honor NUMA hinting falls. > As we want to stop setting FOLL_HONOR_NUMA_FAULT implicitly, set > FOLL_HONOR_NUMA_FAULT whenever we might obtain pages on behalf of a VCPU > to map them into a secondary MMU, and add a comment why. > > Do that unconditionally in hva_to_pfn_slow() when calling > get_user_pages_unlocked(). > > kvmppc_book3s_instantiate_page(), hva_to_pfn_fast() and > gfn_to_page_many_atomic() are similarly used to map pages into a > secondary MMU. However, FOLL_WRITE and get_user_page_fast_only() always > implicitly honor NUMA hinting faults -- as documented for > FOLL_HONOR_NUMA_FAULT -- so we can limit this change to a single location > for now. > > Don't set it in check_user_page_hwpoison(), where we really only want to > check if the mapped page is HW-poisoned. > > We won't set it for other KVM users of get_user_pages()/pin_user_pages() > * arch/powerpc/kvm/book3s_64_mmu_hv.c: not used to map pages into a > secondary MMU. > * arch/powerpc/kvm/e500_mmu.c: only used on shared TLB pages with userspace > * arch/s390/kvm/*: s390x only supports a single NUMA node either way > * arch/x86/kvm/svm/sev.c: not used to map pages into a secondary MMU. > > This is a preparation for making FOLL_HONOR_NUMA_FAULT no longer > implicitly be set by get_user_pages() and friends. > > Signed-off-by: David Hildenbrand Seems sane but I don't know KVM well enough to know if this is the only relevant case so didn't ack. -- Mel Gorman SUSE Labs