Message ID | 20230803143208.383663-5-david@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4A9BC04A6A for <linux-mm@archiver.kernel.org>; Thu, 3 Aug 2023 14:32:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE00128026A; Thu, 3 Aug 2023 10:32:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D902F28022C; Thu, 3 Aug 2023 10:32:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C30CC28026A; Thu, 3 Aug 2023 10:32:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AB2C828022C for <linux-mm@kvack.org>; Thu, 3 Aug 2023 10:32:40 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 27CC21A03C2 for <linux-mm@kvack.org>; Thu, 3 Aug 2023 14:32:39 +0000 (UTC) X-FDA: 81083034480.22.0C1C64F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 13F378008F for <linux-mm@kvack.org>; Thu, 3 Aug 2023 14:32:32 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="cFQu/4Y6"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691073153; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Xlcu86mCEhwN5RlV1rQQu0rKBbZXpgB+gRX7zo+2ELE=; b=gHImPBtJtmfujB7N0TtUb5TcCyOjuyQJFr9mGSpYGHt79sZwgwjaxXCbJQFJpntrV8sibr TftJyNknBfsEfDUCzCZ2S53NQV0NUJPjHrns1g5WRt0pgc/q63Zo0YB0jETygLgmtLdqcu H+664il9XX8WKKKwVWIvVZD7Xs/kTJw= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="cFQu/4Y6"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691073153; a=rsa-sha256; cv=none; b=1HySR7YakNuSvafClhXgX1NnHkRwL2KR3IEwodKC7BlvrWhcH6HnaN4uHrrciOYIc1zKOW +255l3WcYQX0iZFZ42Uxt4aDiLMszU+4e05yT4kjc79OF70hGFioK5TgX4EXAqp+CF0S8i A+sPBHag7z91JChx+4xe1buyyxKo1JA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691073152; 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: in-reply-to:in-reply-to:references:references; bh=Xlcu86mCEhwN5RlV1rQQu0rKBbZXpgB+gRX7zo+2ELE=; b=cFQu/4Y6U9s/Qr86W3jKrY7IwhwYua0hV3gTrlXTpn9IgMNfVfORLDhFo+xxYHQWShbKYu VNhZWB/emhscNEtre9KTeuD8oEyCTKHIUG9MNI7MsH90HBCNx36H6+MfFGcQlGnHaiq/E7 yi7Dy/bSlo9HD/qr3nVW4Y+2zGltolU= 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-194-xKca5kjkPeqZ-tCl_i7x9A-1; Thu, 03 Aug 2023 10:32:26 -0400 X-MC-Unique: xKca5kjkPeqZ-tCl_i7x9A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0BE7B805AF6; Thu, 3 Aug 2023 14:32:26 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.193.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7401F201EE6E; Thu, 3 Aug 2023 14:32:23 +0000 (UTC) From: David Hildenbrand <david@redhat.com> To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, David Hildenbrand <david@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org>, liubo <liubo254@huawei.com>, Peter Xu <peterx@redhat.com>, Matthew Wilcox <willy@infradead.org>, Hugh Dickins <hughd@google.com>, Jason Gunthorpe <jgg@ziepe.ca>, John Hubbard <jhubbard@nvidia.com>, Mel Gorman <mgorman@suse.de>, Shuah Khan <shuah@kernel.org>, Paolo Bonzini <pbonzini@redhat.com> Subject: [PATCH v3 4/7] mm/gup: don't implicitly set FOLL_HONOR_NUMA_FAULT Date: Thu, 3 Aug 2023 16:32:05 +0200 Message-ID: <20230803143208.383663-5-david@redhat.com> In-Reply-To: <20230803143208.383663-1-david@redhat.com> References: <20230803143208.383663-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Queue-Id: 13F378008F X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: g31pm6pc5m4g3qnnszqyii6y5cmb14r7 X-HE-Tag: 1691073152-717937 X-HE-Meta: U2FsdGVkX1+Ha6WqjkFQCNYDO+pLOq7oaRxlnOljZ0AIN0qVBtLD5snr+VsLF6Nu9XZALvRgOi3oFJNwEuxLxYDUp3ql+kkuIgwcBD5tvvxhaV+kBROd1avws2dpmT22zsEc/jKebcnBYzoiToegECCBQxOypoCnVjYIl5P7SVti1NirBcLWkiEp0x4MtBwX6HpJOyMyXZFUu2hbmJfx0rFnKzboi9NR/5Mf7x8QXvavXF72ehOjVys0vQ9zCOOLoeP7m5mk8M9Lp0smx74F1kpkiFgdHgGaRsAmJYdZVYdJ9bEnPGAyMO6X8Xrv58SxZEYYpptV5ysArVH5PzP9fPROTq3HUDvuLehNDJGMG3cpZgUs5QokkzTDyfFU9NXJhBEQgJgvt278IoIrRziDFi/4SKe/wej1Yl5a86v2/4aINifzzJBKLOdt8/bhw/74c8Qd+4G6zQp5NQoF2jze5slyLMW35Uw1AD38ZONWveXI9D5jlGXZF4XsKjc8YxTOjqlReO3yd45hdJDa6s3vjs/Aq8hp/YODlFpb/6ajszHAlWdg53uCqxy8VnU8JRGJBlgnE9kGhw8/BLDlcJ69UDtIyL7h0qa5cC9D6Ga2XRUqQdCrVMQN2wwbHbYM/8dH140R1Ss5b29+J4luk78JVLKoFNX9P1go33efpDhNyCxwNjMxGfcZfhfH2YYZTuYCn8Hn+3LRx6CIqJ0qX22LsRF9Xlgyc8+/6WTaj3CPf8UxAfRtNF6I47BzTxzH/TPyeeo4WNkOmoLJjUCq8yKScTHomCaaMqH3mgjlTvmqCTcFKByyKXCzkt0yfIQtVHL+8Q0t29NzkaAnG9bMDlPEqGSi++As5FfGYKdArv8BXtAFhXpdjJoxS3iMy3O3kywSiyPD2f6gbX0MCPPmWNUdI9QuxsfJcuJOPwOsPDX7qTN9QrUC4vnuSBocu9D8wC06wgIOxK1ps3wDLuuaBJK j/qAt4Ny Fb0HchLhG25/xBSGZe/NKnkdOlA8SHcI3TyQkKVQgCJKewbm0TFa4XTwQkB/hdeiQZbOehlZgTnuSmOy/lY5ylTTfeaXIj2i2spv3vcq1ImQ7aeUaqjiWkZBJzCsOdV4k7fzX/QA1GfHelg983QDxs8y/ESTT88RAyXWGKMeH/+p3rt+9/YxF+SRyeeK8WlW4EFRkvoHSqTrbSAD8u7SPNtSUKg== 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: <linux-mm.kvack.org> |
Series |
smaps / mm/gup: fix gup_can_follow_protnone fallout
|
expand
|
diff --git a/mm/gup.c b/mm/gup.c index 3bbfae411880..ee4fc15ce88e 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2244,13 +2244,6 @@ static bool is_valid_gup_args(struct page **pages, int *locked, gup_flags |= FOLL_UNLOCKABLE; } - /* - * For now, always trigger NUMA hinting faults. Some GUP users like - * KVM require the hint to be as the calling context of GUP is - * functionally similar to a memory reference from task context. - */ - gup_flags |= FOLL_HONOR_NUMA_FAULT; - /* FOLL_GET and FOLL_PIN are mutually exclusive. */ if (WARN_ON_ONCE((gup_flags & (FOLL_PIN | FOLL_GET)) == (FOLL_PIN | FOLL_GET)))
Commit 0b9d705297b2 ("mm: numa: Support NUMA hinting page faults from gup/gup_fast") from 2012 documented as the primary reason why we would want to handle NUMA hinting faults from GUP: KVM secondary MMU page faults will trigger the NUMA hinting page faults through gup_fast -> get_user_pages -> follow_page -> handle_mm_fault. That is still the case today, and relevant KVM code has been converted to manually set FOLL_HONOR_NUMA_FAULT. So let's stop setting FOLL_HONOR_NUMA_FAULT for all GUP users and cross fingers that not that many other ones that really require such handling for autonuma remain. Possible interaction with MMU notifiers: Assume a driver obtains a page using get_user_pages() to map it into a secondary MMU, and uses the MMU notifier framework to get notified on changes. Assume get_user_pages() succeeded on a PROT_NONE-mapped page (because FOLL_HONOR_NUMA_FAULT is not set) in an accessible VMA and the page is mapped into a secondary MMU. Once user space would turn that mapping inaccessible using mprotect(PROT_NONE), the actual PTE in the page table might not change. If the MMU notifier would be smart and optimize for that case "why notify if the PTE didn't change", that could be problematic. At least change_pmd_range() with MMU_NOTIFY_PROTECTION_VMA for now does an unconditional mmu_notifier_invalidate_range_start() -> mmu_notifier_invalidate_range_end() and should be fine. Note that even if a PTE in an accessible VMA is pte_protnone(), the underlying page might be accessed by a secondary MMU that does not set FOLL_HONOR_NUMA_FAULT, and test_young() MMU notifiers would return "true". Signed-off-by: David Hildenbrand <david@redhat.com> --- mm/gup.c | 7 ------- 1 file changed, 7 deletions(-)