Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp429897rwb; Thu, 27 Jul 2023 15:19:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlH7QIlX0ct4pvxvZ6QqWdJbawdEozE/VsK8Mrx3HrpkGire4BNJRhFL/bCPu6zeYQe+hV1s X-Received: by 2002:a17:902:ab1a:b0:1bb:d586:d29a with SMTP id ik26-20020a170902ab1a00b001bbd586d29amr4022086plb.34.1690496378923; Thu, 27 Jul 2023 15:19:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690496378; cv=none; d=google.com; s=arc-20160816; b=WJXKHjbbRaB4aabRQ5W0Xk0jkfALfwxu1ar7lL+i17qj3orgnt5Nyjj0DS8tbTYQ9Y KMiCSx1yfyF8CFmifoMcLunUW45GhddJ0421xtBlCJwtfQ+yC57no6qIdC6z+ukPYnTS TMJGUTU7ZiXk8147IxUKLidqAti6o3lRRUg7iZ6WhtDSQsDc6mByhlmvD6Q7FuWYpyq4 ZIT+itrjAiUoOrVoEXzOUR4UT46zQ8x3x8P5X6p3POWNZMSYYz2H1rR4FAi+YMFXsf5H VWtfqHmEOpTNXkDueHBSjbEgxptFA6r7G0ggrpt+F8L47CphIAW+xwixcjec+ccOR+zl Rx3g== 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=MHtDEcJmjYkfEI+Ix28zkYwSjHjzxbeRw7Afa8s+sDk=; fh=7Rgwgprh6RG9EUsex42/VTSquO8kknsMsxso4zkcjrY=; b=WxjjCXPiCV+mv5H+6xfj174LF83IKQ/wu3a7vSslH9Ev8R/7Ci/homn9WANNi3eyEp 20LBvQQZm+/SUaSw8vcoFz4HXfcNAPHDRpz0tTKWupX8aCzBWAjbNz9ZbCKuSCp5wt7p wlFS9Noe0EacxTV9yfV66GVmgl+bqFImBbGK9vQ+a5GndSmEiXtFc1s3G2YYAYATqlaa M0y+1CQoK5fac4/rn3ojsoWi4StGU6zqysmlWDb3qX38mS8aErJnlJ6WnPT9JDXFdS0x O1+fgQoGz52VIM8h+TOQzeBkcVvDDaUjSjQJcks1Xj4Qp21tz1vW9AmzW7QTPWtHNfoL WOFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V1sPIIzf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l134-20020a633e8c000000b005533647f7c5si397578pga.420.2023.07.27.15.19.27; Thu, 27 Jul 2023 15:19:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V1sPIIzf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230017AbjG0V3i (ORCPT + 99 others); Thu, 27 Jul 2023 17:29:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbjG0V3h (ORCPT ); Thu, 27 Jul 2023 17:29:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 043BCD9 for ; Thu, 27 Jul 2023 14:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690493334; 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=MHtDEcJmjYkfEI+Ix28zkYwSjHjzxbeRw7Afa8s+sDk=; b=V1sPIIzftjOYK8qE/VqLnjqIpKJnj11YlUdStCrSUt7UBjpMY9UhO6zdOiX6r+yBS8nj9E dBjU2JvKSH7djaxsYA9xlpFWSHIQtR58gNC4cUr+E0egLqvgsZ6MukU4vHwQTaaArRQ5yN HE/x+SK4Atayv19HiJiF9StfvYrjJPc= 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-477-SSSPx73SMmCaNq4xHLAjEw-1; Thu, 27 Jul 2023 17:28:50 -0400 X-MC-Unique: SSSPx73SMmCaNq4xHLAjEw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D69AE101A54E; Thu, 27 Jul 2023 21:28:49 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id C073D40C2063; Thu, 27 Jul 2023 21:28:46 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , Linus Torvalds , liubo , Peter Xu , Matthew Wilcox , Hugh Dickins , Jason Gunthorpe , John Hubbard Subject: [PATCH v1 0/4] smaps / mm/gup: fix gup_can_follow_protnone fallout Date: Thu, 27 Jul 2023 23:28:41 +0200 Message-ID: <20230727212845.135673-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is my proposal on how to handle the fallout of 474098edac26 ("mm/gup: replace FOLL_NUMA by gup_can_follow_protnone()") where I accidentially missed that follow_page() and smaps implicitly kept the FOLL_NUMA flag clear by *not* setting it if FOLL_FORCE is absent, to not trigger faults on PROT_NONE-mapped PTEs. (maybe it's just me who considers that confusing) Patch #1 is the original fix proposal, which patch #3 cleans up. Patch #2 is another fix for the issue on the follow_page() level pointed out by Peter. Patch #4 documents the FOLL_FORCE situation. Peter prefers a revert of that commit [1], I disagree and am still happy to see FOLL_NUMA gone that implicitly relied on FOLL_FORCE. An alternative might be to use an internal FOLL_PROTNONE or FOLL_NO_PROTNONE flag in patch #3, not so sure about that. Did a quick sanity test, will do more testing tomorrow. [1] https://lkml.kernel.org/r/ZMK+jSDgOmJKySTr@x1n Cc: Andrew Morton Cc: Linus Torvalds Cc: liubo Cc: Peter Xu Cc: Matthew Wilcox Cc: Hugh Dickins Cc: Jason Gunthorpe Cc: John Hubbard David Hildenbrand (3): mm/gup: Make follow_page() succeed again on PROT_NONE PTEs/PMDs smaps: use vm_normal_page_pmd() instead of follow_trans_huge_pmd() mm/gup: document FOLL_FORCE behavior liubo (1): smaps: Fix the abnormal memory statistics obtained through /proc/pid/smaps fs/proc/task_mmu.c | 3 +-- include/linux/mm_types.h | 25 ++++++++++++++++++++++++- mm/gup.c | 10 +++++++++- 3 files changed, 34 insertions(+), 4 deletions(-) -- 2.41.0