Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4302267rwe; Mon, 17 Apr 2023 10:34:16 -0700 (PDT) X-Google-Smtp-Source: AKy350Y/B1Bjpv/urOlRsQxBsIAb0IbDpXN+fs/MKT9eIysA+N9Obp1mYy2Cf1ndl7MfgWATKnTl X-Received: by 2002:a05:6a20:4320:b0:f0:ffb:d1e2 with SMTP id h32-20020a056a20432000b000f00ffbd1e2mr3588848pzk.53.1681752856335; Mon, 17 Apr 2023 10:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681752856; cv=none; d=google.com; s=arc-20160816; b=1LCtvcN665Du1KbPbWCNZaqHCYKKhvBODsstcFwIUfzgYLFGNhY9NXa4ohm3tY/S03 wkrmNPqXGNZDNa+QbXnKmdJ84eBJA+z6EDCJUowwaCk6CwA9mpUuMqxBVR9yd1R887LF dTLMa0H7Or9NWFPzfTPehIg9riz6kaE/EreHcfJzKM2SAofltj3toZ9gZHKxoE0Wq56P 1NkB7mm3Tz2xg+GXrwcW9HPPF0RRv+DcwI2yO7kemqHzIZpST4Cl/+oPViBwIIJxK8Z8 cu84IriOkwb/441zz/BV60p8wqatrZ60MQIiG1TapilqphRufHHxObNEw3mL4PaumXjj kmCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+tuJX1We1PoACh/ojLaOjM7tDLHm8IU9UAe1VlYXWPI=; b=1FnDGg5lco6QILkp/zIF7KX+dWunfOp1kwPZlRA9DIjS7RGh97dUcrUQPqiAgC4w1s 2wFApo8lsU1fi6cmQwRYdby4diY583hHSQHjC/IX+xWKGgtm5aUOju7p2vJJeLCxa7Ll +10bqyFs9teM+dV9XTtC2uWP+Zbcg+Tco5zVYiVq+JCedXTP+nGx37kb6U96bN5iMA7J OK3JHtNQ6AGurNqaTxgUSwFmrM37BPkxNmGpK56pukxneWJ6+vaTPlpojt+UIfEFZ/BX l46op3hozr1kilUjI48fs7WCPU0o2NMCVK6x7ssH8iH8LyuQ0eavwKCKUKdGiCIVRHo8 MUBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=bUnZZH0k; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm18-20020a656e92000000b005073e3342eesi12648724pgb.143.2023.04.17.10.34.02; Mon, 17 Apr 2023 10:34:16 -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=@infradead.org header.s=casper.20170209 header.b=bUnZZH0k; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230249AbjDQR1R (ORCPT + 99 others); Mon, 17 Apr 2023 13:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbjDQR1Q (ORCPT ); Mon, 17 Apr 2023 13:27:16 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2598E1FE9 for ; Mon, 17 Apr 2023 10:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+tuJX1We1PoACh/ojLaOjM7tDLHm8IU9UAe1VlYXWPI=; b=bUnZZH0kAE3IObO93zsnJUTx41 wqOIdkHeJO2hWJQZyfOojZIZqzPzpCp0fsa29aGznFH48P8Qdvl7JrD3GRgYLxGfnk/mPt7b3Cj89 +SeKo8+FjmHnHu+f+fIMcS2e0HYFWRkax+q6pn714X11WW2hLGmlmH2eaNwxOGAoFht2uzVW8WKop Kh85oRyH+MHYIcT3nvMfC63wbVPFAfhTuzU28qiZ/7wvffCoh57nHHDCWjUbX1Ad2JxHhSFKZHbPX Z0osQ5va9P6+UmQgr9eYCkOKHdOHAtbeskZXAMDmLoAUjKYXtpeR+0l72zB1FoXmxnawTiVq47bhq k1iWoXLw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1poScf-00BXC2-Vu; Mon, 17 Apr 2023 17:26:38 +0000 Date: Mon, 17 Apr 2023 18:26:37 +0100 From: Matthew Wilcox To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@suse.com, josef@toxicpanda.com, jack@suse.cz, ldufour@linux.ibm.com, laurent.dufour@fr.ibm.com, michel@lespinasse.org, liam.howlett@oracle.com, jglisse@google.com, vbabka@suse.cz, minchan@google.com, dave@stgolabs.net, punit.agrawal@bytedance.com, lstoakes@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 1/1] mm: do not increment pgfault stats when page fault handler retries Message-ID: References: <20230415000818.1955007-1-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230415000818.1955007-1-surenb@google.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Fri, Apr 14, 2023 at 05:08:18PM -0700, Suren Baghdasaryan wrote: > /* > - * We don't do accounting for some specific faults: > - * > - * - Unsuccessful faults (e.g. when the address wasn't valid). That > - * includes arch_vma_access_permitted() failing before reaching here. > - * So this is not a "this many hardware page faults" counter. We > - * should use the hw profiling for that. > - * > - * - Incomplete faults (VM_FAULT_RETRY). They will only be counted > - * once they're completed. > + * Do not account for incomplete faults (VM_FAULT_RETRY). They will be I don't think you need the "(VM_FAULT_RETRY)" here. > @@ -5180,21 +5186,22 @@ static vm_fault_t sanitize_fault_flags(struct vm_area_struct *vma, > vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address, > unsigned int flags, struct pt_regs *regs) > { > + /* Copy vma->vm_mm in case mmap_lock is dropped and vma becomes unstable. */ How about: /* If the fault handler drops the mmap_lock, vma may be freed */ > + struct mm_struct *mm = vma->vm_mm;