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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51702C433DF for ; Wed, 17 Jun 2020 16:11:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F7482080D for ; Wed, 17 Jun 2020 16:11:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Nnp6bJyp"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FIlQShFU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F7482080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=puAFaoSeUJkNZla8ZNE55pMqyzVq7MIN4/I1/bqDAjQ=; b=Nnp6bJypZdjZxc JjfSgzsmFmpHnBWFHpXgt7jZB4C+ltnRDuZFRyJrh3swMBKSm1mGN7nFAwReiU+tWGtgzf7UcP1qi Es0RsqPfeMtq5rCYfPYMTivzmEiv01cECNFsAOXo7aN2vPg2VLljBtptRB5H/286dm5K3yIT7/I6u 3gsWZ38+Vcg+rDf8SK8Zr3Yuon3ua3rFX9Lbs+lBi1GDNRx5sE7GLuPZJgyJ55c0gY5So+vPb5zPi ehifwyR9k5Eewfkk7sWuyFtkk61zRgLjlimKl2aqnyX3bW6FU1RZxN/GQXY9CSxDYHVtb++QNzyTx U/MkAMFkx0Hs0azKLg1g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jlaeS-0007Wi-EH; Wed, 17 Jun 2020 16:11:00 +0000 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120] helo=us-smtp-1.mimecast.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jlaeO-0007W2-Lj for linux-arm-kernel@lists.infradead.org; Wed, 17 Jun 2020 16:10:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592410254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pwPndLdm35gmxUTd/yGdLqQ8FsjkAPP7/6FDJCdV2mM=; b=FIlQShFUpHaVXIsePnoHC1W1OkcqaZqCtukZ4mqpuf7wwU4hEHqFZaneFC4Hr8zS0aOvXq 28aAw31xUOtmFiOT1i39WZznxjCXAs5hqoZw2OHmljcrSEGvOuX6DAQ+QDXUtrv4lOP8J2 Ss5p50Cfhoc1G9Ci4HohIrTKsh8ynoo= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-81-LBWohS55N9GUXKAavyV0OQ-1; Wed, 17 Jun 2020 12:10:52 -0400 X-MC-Unique: LBWohS55N9GUXKAavyV0OQ-1 Received: by mail-qt1-f198.google.com with SMTP id k23so2109823qtb.2 for ; Wed, 17 Jun 2020 09:10:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=pwPndLdm35gmxUTd/yGdLqQ8FsjkAPP7/6FDJCdV2mM=; b=GhnS32b0/d3j96qw9S2kaApzt01jd3MpkvvecJVyVClLmnzOPLIv9eZKtj8MQCdlB8 Hf3hUDhE950d8e6ou4U6iWj9yNODA/USmzWjRI0qCIG6O+NV2XHm3cD82w15Sihbp8sQ GPMYd59tYYwTOu/FbzVjbkxOr0sJfUdAQsqvJ+itvSP8yYGu3VNZpCyfkC8BWsL+1rgx EW4im6Mu+yqCt8aKqiCimuAAAmBpY6I6X9SGOpNLaYUco+pZcqRJfaqsMXT1oFgTgT0S fk9orD9BNpnHg8fXclgviCWHNCU9kz4HsBBzAZE9tq0u43imV23BW0UCQ7uYbLV2Drfw iZpg== X-Gm-Message-State: AOAM533gbdesbCQKCuSk5cen2RewOnZkFthbeUUzJDJThzFF2/qI8x+z gt/+yDQuD4Tfhs+qvMhTswev++m1RtXOkXzROVv8ppTvArMfUOtVynWQc6T3BiXO+xK1VxCCWll gqzygaM4O/xd58VmhFvVdN28urSiKtidfeEU= X-Received: by 2002:ac8:fb4:: with SMTP id b49mr27502907qtk.323.1592410252034; Wed, 17 Jun 2020 09:10:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHPvRTdazh3ByXAbV1+DQb3IK/Hxo+xAXMp5hAEJHzAOp6L2Jx/mkBgpOD51Mg4XUcXd/11g== X-Received: by 2002:ac8:fb4:: with SMTP id b49mr27502878qtk.323.1592410251778; Wed, 17 Jun 2020 09:10:51 -0700 (PDT) Received: from xz-x1 ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id b4sm265252qka.133.2020.06.17.09.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 09:10:51 -0700 (PDT) Date: Wed, 17 Jun 2020 12:10:49 -0400 From: Peter Xu To: Will Deacon Subject: Re: [PATCH 00/25] mm: Page fault accounting cleanups Message-ID: <20200617161049.GE76766@xz-x1> References: <20200615221607.7764-1-peterx@redhat.com> <87imfqecjx.fsf@mpe.ellerman.id.au> <20200617080405.GA3208@willie-the-truck> MIME-Version: 1.0 In-Reply-To: <20200617080405.GA3208@willie-the-truck> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200617_091056_785097_0325105B X-CRM114-Status: GOOD ( 24.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrea Arcangeli , linux-arch , linux-s390 , Michael Ellerman , Linux Kernel Mailing List , openrisc@lists.librecores.org, Linux ARM , Catalin Marinas , Andrew Morton , Linus Torvalds , Alexander Gordeev , Gerald Schaefer Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 17, 2020 at 09:04:06AM +0100, Will Deacon wrote: > On Wed, Jun 17, 2020 at 10:55:14AM +1000, Michael Ellerman wrote: > > Linus Torvalds writes: > > > On Mon, Jun 15, 2020 at 3:16 PM Peter Xu wrote: > > >> This series tries to address all of them by introducing mm_fault_accounting() > > >> first, so that we move all the page fault accounting into the common code base, > > >> then call it properly from arch pf handlers just like handle_mm_fault(). > > > > > > Hmm. > > > > > > So having looked at this a bit more, I'd actually like to go even > > > further, and just get rid of the per-architecture code _entirely_. > > > > > > > > > One detail worth noting: I do wonder if we should put the > > > > > > perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); > > > > > > just in the arch code at the top of the fault handling, and consider > > > it entirely unrelated to the major/minor fault handling. The > > > major/minor faults fundamnetally are about successes. But the plain > > > PERF_COUNT_SW_PAGE_FAULTS could be about things that fail, including > > > things that never even get to this point at all. > > > > Yeah I think we should keep it in the arch code at roughly the top. > > I agree. It's a nice idea to consolidate the code, but I don't see that > it's really possible for PERF_COUNT_SW_PAGE_FAULTS without significantly > changing the semantics (and a potentially less useful way. Of course, > moving more of do_page_fault() out of the arch code would be great, but > that's a much bigger effort. > > > If it's moved to the end you could have a process spinning taking bad > > page faults (and fixing them up), and see no sign of it from the perf > > page fault counters. > > The current arm64 behaviour is that we record PERF_COUNT_SW_PAGE_FAULTS > if _all_ of the following are true: > > 1. The fault isn't handled by kprobes > 2. The pagefault handler is enabled > 3. We have an mm (current->mm) > 4. The fault isn't an unexpected kernel fault on a user address (we oops > and kill the task in this case) > > Which loosely corresponds to "we took a fault on a user address that it > looks like we can handle". > > That said, I'm happy to tweak this if it brings us into line with other > architectures. I see. I'll keep the semantics for PERF_COUNT_SW_PAGE_FAULTS in the next version. Thanks for all the comments! -- Peter Xu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel