Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1998203ybt; Mon, 15 Jun 2020 15:21:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4+qzTAfCW41hd3m1to6r/zZcJCc7gazRT2F0icwIFUendKsHpEMMQIrVhYWrXFD3Hi+8c X-Received: by 2002:a17:906:fcae:: with SMTP id qw14mr1239ejb.166.1592259663180; Mon, 15 Jun 2020 15:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592259663; cv=none; d=google.com; s=arc-20160816; b=FezWVkHOwzLA7hO+4KptDKqdgZ7995uA+54gq9kNu54KjVcT9npp4sU4tQDUmS0/jX /6buMBrtQIZFwUfpZmMrLcnq2d26lPlFqeK0es3fCYw1KuQ1DCF2NeaC9Jh+TMyJICmq LfEDT+fQx7T6CnOZaiB99Wu6+CgKC1UVFUI6hxC0TkauVNCqqLp7gR2XWqdm0HIieBJs ZZV58FK/8azaJ2kuSEERp+1ZqHiNwuVb+nSpJMS5lq5xQqCVW+94QY3h43U5AAJNySDC DPEMSeO61u3RkJPkVvUkMvCaQnsmYdnbSerfeqT3AkOQcu+0i5DUU/vEJZEwKaPhl5Db Kyng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eGLIpLum9/bkEKfHV3oPe4nmlL39+Vf3k9heSN4qJAU=; b=Y6YezQazOc6Drm5wn/VPE1nsJRbpoKsJ5hHp2wq5s5QgxQfzNmrTTSMKz/MArMVeT+ vv+JZcwd4qvo+4I0c7C1XNvCShmjLSoG24OHJZlGRX/NusqvU2UWnSnAmb75bBKTpOC/ NPU4eB8A1gAfIC1KDuuo02qEQ54wVj8DwE3yPMvfnxgsomTsv6VlmuFOrcfNt3ba+O+E fjad3A1vD0C2ZPRcSv/mjevzzkuwy9H0pHnnKFDq8GqcOWC5wSTiUPJ1Of603fc+bgsA dETNrqhdTA+HGvFg3tcyylVxiag0FiKxyLj00n0qMkml4kd3TCHmd33z/j6b34j9hjzX ToOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="d5JnA/26"; 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 gl17si9856433ejb.336.2020.06.15.15.20.41; Mon, 15 Jun 2020 15:21:03 -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="d5JnA/26"; 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 S1726653AbgFOWQt (ORCPT + 99 others); Mon, 15 Jun 2020 18:16:49 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:43350 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726628AbgFOWQo (ORCPT ); Mon, 15 Jun 2020 18:16:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592259403; 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: in-reply-to:in-reply-to:references:references; bh=eGLIpLum9/bkEKfHV3oPe4nmlL39+Vf3k9heSN4qJAU=; b=d5JnA/26WFMm4GMKiQYcXdRfQEg5KoeHxpDv2CToNEdTUZHS+SmDfvj1r5WCYk1xgAyNrG TedhexRk6wr+1Yu5h1Ll6TumNXLNZLrT9612p8QR6JFYd9GJF6zuG3iO/EjGEaM6rBJ05B HzUJ4abVCYyw/FXVNtoAAp42bGfKloo= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-493-peet_ZG7PrKxVYYsVuynwg-1; Mon, 15 Jun 2020 18:16:36 -0400 X-MC-Unique: peet_ZG7PrKxVYYsVuynwg-1 Received: by mail-qv1-f71.google.com with SMTP id a8so14139669qvt.7 for ; Mon, 15 Jun 2020 15:16:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eGLIpLum9/bkEKfHV3oPe4nmlL39+Vf3k9heSN4qJAU=; b=nNx3KpvWiZ7GNITsviNmBWIgoDAFUtK8sk3YrCPxvyj6EMYIyOzHS7Cc/LgvQRkyxa P2YUFg8USABXqCPVSit0Onl6nG3qSFGWKdOmFFci990YEWwEzjXFC8sA4aKnKOfvhpjC piioAGQsqZUZo18Hd778ExysGXE/u02zClu2bLVPLhyh0LmWX9Z0BsLkKCZojp77Tef7 8aKplvOuBkbixcOKa+xCNjYYMg84VsEVkIpnJUOoJMry5KsLojHgy5oqjKxWLpawdNU+ 1bX4auAfDol1RoA3RKLTLD2EjBM1UrwZI+U4L0FP0k1vJ/fE/hFvxFQLl4zSBzz4fj+w P8jQ== X-Gm-Message-State: AOAM5325cQh4mUh81miTPHu/4HGMpYUcfl7RZxLfxXRyB4s1tVOQ3T3F KpWvNyf0/cvU0fQpCCeHzFhdjVPKHzutXqs3sY/29h0ebr+ou//cRYJr/Vkshz4HXUD0xY6/LE7 XR2DBuqye0MhBoOZBnYlcGqos X-Received: by 2002:ac8:551a:: with SMTP id j26mr18359196qtq.237.1592259396034; Mon, 15 Jun 2020 15:16:36 -0700 (PDT) X-Received: by 2002:ac8:551a:: with SMTP id j26mr18359173qtq.237.1592259395830; Mon, 15 Jun 2020 15:16:35 -0700 (PDT) Received: from xz-x1.hitronhub.home ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id w13sm12351509qkb.91.2020.06.15.15.16.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2020 15:16:35 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org Cc: Gerald Schaefer , Andrew Morton , peterx@redhat.com, Linus Torvalds , Andrea Arcangeli , Jonas Bonn , Stefan Kristiansson , Stafford Horne , openrisc@lists.librecores.org Subject: [PATCH 15/25] mm/openrisc: Use mm_fault_accounting() Date: Mon, 15 Jun 2020 18:15:57 -0400 Message-Id: <20200615221607.7764-16-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200615221607.7764-1-peterx@redhat.com> References: <20200615221607.7764-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the new mm_fault_accounting() helper for page fault accounting. Avoid doing page fault accounting multiple times if the page fault is retried. Also, the perf events for page faults will be accounted too when the config has CONFIG_PERF_EVENTS defined. CC: Jonas Bonn CC: Stefan Kristiansson CC: Stafford Horne CC: openrisc@lists.librecores.org Signed-off-by: Peter Xu --- arch/openrisc/mm/fault.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/openrisc/mm/fault.c b/arch/openrisc/mm/fault.c index 8af1cc78c4fb..594195ae8cdb 100644 --- a/arch/openrisc/mm/fault.c +++ b/arch/openrisc/mm/fault.c @@ -49,7 +49,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address, struct mm_struct *mm; struct vm_area_struct *vma; int si_code; - vm_fault_t fault; + vm_fault_t fault, major = 0; unsigned int flags = FAULT_FLAG_DEFAULT; tsk = current; @@ -160,6 +160,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address, */ fault = handle_mm_fault(vma, address, flags); + major |= fault & VM_FAULT_MAJOR; if (fault_signal_pending(fault, regs)) return; @@ -176,10 +177,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address, if (flags & FAULT_FLAG_ALLOW_RETRY) { /*RGD modeled on Cris */ - if (fault & VM_FAULT_MAJOR) - tsk->maj_flt++; - else - tsk->min_flt++; if (fault & VM_FAULT_RETRY) { flags |= FAULT_FLAG_TRIED; @@ -193,6 +190,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address, } up_read(&mm->mmap_sem); + mm_fault_accounting(tsk, regs, address, major); return; /* -- 2.26.2