Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp593445pxf; Wed, 7 Apr 2021 07:11:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymQO4WTeyo2lhy29hZex1Nx8ouZSiRUIJgc1t6z69LXqIAvo/Lofnp4AnuNPstLvEsvh7/ X-Received: by 2002:a17:907:93a:: with SMTP id au26mr3964115ejc.47.1617804693577; Wed, 07 Apr 2021 07:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617804693; cv=none; d=google.com; s=arc-20160816; b=Nd8howdPU4QkmXnTJpzruRCB8LsQk36O6Y1n9SdNOosT/jU52Azlo412KKq9I6t4r7 gOXDrHuCOO8D6My3EHBbVf2HOZ04K09qbkVgTnxTyHl7DZE/98PPBzsx0dGppiqtzZ+V 6y9dymecfI60mUeYe7V7czmvrQa1a0QSoqQMxS0yZLxlFhAtKNKngmfXk4Y0EgIpEAhG OqT63faNJ8aBgU2TALGtESQE+P5CgBBK9rSyaPTPFxiNAMVTqsb/eaMVaed6TwHLrCWF rkNilr1uo+Tgcxh6Zdavs3PgQL093SYRNkNshhQ6rExJnNJwV5jZODgIomAH0i5e0tgp 3Epg== 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=czw0NKvfj1CYNJsZJ8QXfSvhtH1Tu2flRlleTlgXKQk=; b=wc43gVrcJn32VTLsZ62TbB/8oGIiUg8uYHjMq7UGgcL8gbKT9pCSZdN58voHxqZ7mG e602lzqvjrCVqnWHdesbFvb+gHNUImQzUwSXd1ZwsxhUXivKpQG9TbLLoNreUgIBLLkX CzVUQU11eHdRweTifTCn3ZkwmJgxq+xDLFdTQy8OXWfXv2CUbLMU6gkX8yXAylvJTfVC K+LTcO46plP016bNXseyHLrI1uiq3HWr5ywc4NnAih+Z2nzhk15ZSTdaJd83E2dJYsnd JdR+fzR8GGSSfwsxS+NuXCbipFVdEuqZ5wRuVKU7iNwKzXBElGq7qZ9MsQ+jWTCSp6Z0 4SAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sV31xBpM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jo5si5713734ejb.556.2021.04.07.07.11.10; Wed, 07 Apr 2021 07:11:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sV31xBpM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344009AbhDGCtE (ORCPT + 99 others); Tue, 6 Apr 2021 22:49:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233974AbhDGCtD (ORCPT ); Tue, 6 Apr 2021 22:49:03 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DD32C06174A for ; Tue, 6 Apr 2021 19:48:54 -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=czw0NKvfj1CYNJsZJ8QXfSvhtH1Tu2flRlleTlgXKQk=; b=sV31xBpM8O1Dln4u5AytLygMsh o0SMLCFEMvHK+KO5oxpty68CF8FPyhOmQ3cAkdvCVQXyIjP3Sxpk0KP3g0oJu8R2oCqQBiDrb3dHm Tc+tT2IDTnp/MpqLbSMXicIGCqea8hT4tbsgPLGTSyQ4/Gg2y72fUQYXpv4397QtPTdhiTewK9mZT gqbFTsEkSEkctS7yBu81ev71NFJ9SN2Mp0MKi66/8am1DbgomhMdQCY+qbVocx3Wit4J9fq2XzfRW IHXT6AKsr3ZfJymj48W0Zz7GOJ+FpmVRz6Z+kwbg0mBkd8Joy3dNppapODcNvB/xibFJK7wKyQkjQ N/IosjQg==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lTyEl-00DmjV-Dw; Wed, 07 Apr 2021 02:48:15 +0000 Date: Wed, 7 Apr 2021 03:48:11 +0100 From: Matthew Wilcox To: Michel Lespinasse Cc: Linux-MM , Laurent Dufour , Peter Zijlstra , Michal Hocko , Rik van Riel , Paul McKenney , Andrew Morton , Suren Baghdasaryan , Joel Fernandes , Rom Lemarchand , Linux-Kernel Subject: Re: [RFC PATCH 33/37] mm: enable speculative fault handling only for multithreaded user space Message-ID: <20210407024811.GA2531743@casper.infradead.org> References: <20210407014502.24091-1-michel@lespinasse.org> <20210407014502.24091-34-michel@lespinasse.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210407014502.24091-34-michel@lespinasse.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 06, 2021 at 06:44:58PM -0700, Michel Lespinasse wrote: > + /* Only try spf for multithreaded user space faults. */ This comment is misleading ... mm_users will also be incremented for ptraced programs as well as programs that are having their /proc/$pid/maps examined, etc. Maybe: /* No need to try spf for single-threaded programs */ Also, please, can we not use an acronym for this feature? It's not a speculative page fault. The page fault is really happening. We're trying to handle it under RCU protection (if anything the faultaround code is the speculative page fault code ...) This is unlocked page fault handling, perhaps? > + if (!(flags & FAULT_FLAG_USER) || atomic_read(&mm->mm_users) == 1) > + goto no_spf; > + > count_vm_event(SPF_ATTEMPT); > seq = mmap_seq_read_start(mm); > if (seq & 1) > @@ -1351,6 +1355,7 @@ void do_user_addr_fault(struct pt_regs *regs, > > spf_abort: > count_vm_event(SPF_ABORT); > +no_spf: > > /* > * Kernel-mode access to the user address space should only occur > -- > 2.20.1 > >