Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp605979ybt; Wed, 17 Jun 2020 09:13:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq2bU9u++mBWTzuR9H8101yAa1rEHZrFdLJrdMQ9IemaGOjkti7y37vapZgeaaz8L2b3VW X-Received: by 2002:a17:906:c058:: with SMTP id bm24mr7979452ejb.73.1592410399992; Wed, 17 Jun 2020 09:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592410399; cv=none; d=google.com; s=arc-20160816; b=k+z+5kHY61yl74j5WTRzgzsoJ0t8fTuLUETovcqX7kC5slxFu0Hwm3kYQkhcXq3ldL b1VXgTB2rYRFlfiNJ84+7ujs1SkiY1dfm0qFuM8rbjxjdPXDyXT1g5DaZ8wVfahIKMFx 3l1PLyDI6Xgw6N9cpgbrU6JOfjpDVbxG6QwpCifHPPhequI94Hsh5WS5TiANeWV+BtEF HpPOSbTI/lvng0NDwt17fUGTtQQV1uJQ6hUjdy/MDx3tnajxSjGJz/siI05E2MKkORCk 2MDhiWa9YQh5O3qUPcIN18Gai3/LPirh2DV9NK7CcudmkI7azvgWkGBCu/EtlN7qnTrI LdyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=pwPndLdm35gmxUTd/yGdLqQ8FsjkAPP7/6FDJCdV2mM=; b=b6yvHuQ3DrXP5fXIPXg1tZmQyfeI4of/w61r/eTxcGJjHeOhnvz8pa8l1qpDOSuofU 4TQwRIPiI7XP3eIYQba9FFFn/pKPyps0LMJyP/P0vDFcTpf3EPk/Iz7SaDpoFjMcdr2P VY3CphXElumRgrFlUQl6aBjMqMKtd+8TYYy3q8sGzmHi4Mn1C3MC540JayYREJ9baemY NJaIuYJDcMqlc0bC5TEQPe0gXZGK8pNNJMd8rkes6ArUobSVU1HlKt0HAf28x6Bz76Jo XiCbOc+77+lqlA6AVD8i2rg2NW2Y+J9cz1TflaLwOtpwlvE8mOZe/684+YoeHWXuLytr +HHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FIlQShFU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si225962edy.606.2020.06.17.09.12.56; Wed, 17 Jun 2020 09:13:19 -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=@redhat.com header.s=mimecast20190719 header.b=FIlQShFU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726763AbgFQQK5 (ORCPT + 99 others); Wed, 17 Jun 2020 12:10:57 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:39867 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726496AbgFQQK4 (ORCPT ); Wed, 17 Jun 2020 12:10:56 -0400 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-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-207-n-62ueSoPRyZZHKPoBePtQ-1; Wed, 17 Jun 2020 12:10:52 -0400 X-MC-Unique: n-62ueSoPRyZZHKPoBePtQ-1 Received: by mail-qk1-f197.google.com with SMTP id p138so2205719qke.7 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=pTFXFiTbDCjO01K1QfErtmjcUKesgT46jNvFes+3AUjjF0IBQTRVyL4B47l+rouDzG rqyQMBw8sCo4MJZJVC9/wroxbznft0Ge5ICoZ0us1P6HRuu8rz9n0J8lyvalNoP077bW YUyRioJt7enWZcxiwVyIFZ4APNWN2WUlVkZNEAxs3GFjTepO4Q28ayAfO/ZwqA7CDu82 8qAd6iNd2eT9309+XT4eTQCW6C6jMWcbsr//wq2a2l51h6wbvWypsmIw3tslPjn0tHkx OVkxXod0KkAV8IDtWk+SrhpLQRUNRGGrCBeXOFYAZAxdZmTsGZhhHb3S8rF2EC6OPyDu uarg== X-Gm-Message-State: AOAM530SqkbKltDD1N8QzpS45h1/lhZBtC6gtCKESj7KVtyq3HeMqOgz YlPeR1cxES2EFM/92/jZllZZuetSuLqrARyAOGAYYpVfsULtoufQ0R37J2YXBTP069gm2NvB/Sn j9la16I6R8tA9A9PdCYK6tGyY X-Received: by 2002:ac8:fb4:: with SMTP id b49mr27502905qtk.323.1592410252034; Wed, 17 Jun 2020 09:10:52 -0700 (PDT) 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 Cc: Michael Ellerman , Linus Torvalds , Linux Kernel Mailing List , Gerald Schaefer , Andrew Morton , Andrea Arcangeli , openrisc@lists.librecores.org, linux-arch , Alexander Gordeev , linux-s390 , Catalin Marinas , Linux ARM 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200617080405.GA3208@willie-the-truck> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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