Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp604562ybt; Fri, 19 Jun 2020 09:09:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxa3RRRoXNVKLjqOOMGoF03Eg/6VSeFAcR8X6jBwrRYl3MQRnKzV2eK3wg6dypMzhzQiPCA X-Received: by 2002:a17:907:20db:: with SMTP id qq27mr4263486ejb.232.1592582982778; Fri, 19 Jun 2020 09:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592582982; cv=none; d=google.com; s=arc-20160816; b=g29ISfOdOOosV8i9NgNCupWrPpyOiRxKCS2uacCerPD1QRAlkKUX1cz0mBWH14KqqT j9KCVQAyFORJjGHHyQFavnGyk5HuCsPN5blgFZj7qKQePm0t23ixBlxFeQWWFuocfTZw FypfihDJ8ENK501pleR53KR7Yuuswb/Xbhjo4P48J27Oq40KT5i57fpdEsPLxfK/1oY1 W9+LUUfu8868pupSrC8RJvFyrdVUxTTaZ3nim0fSbjGhZVDPMo050DqdFYBV9aDCKt85 HvuYwfHZmPX4p7hTgjBEB3C7xmHvWmomspEA3Xe59lGDBwt9jhJbtpqn/kdK3AxRVf1Q QMvQ== 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=lYOPBG0iFD9F9VjgENlAdm0PiHZqNHDJn1sXF2V/+vk=; b=Nt0/vwiwt1x8McgOnyJMTrAC1syfMoWv+8ISyk6OV8CkzqprpFYTUAStxh2ZtYqXl4 86Xu7VUY/QBFwhKs6hj+XZKvFyLKW9ofknbv3SXsCJYwgPiNJUmg333qKd+yyJotWpV/ VELWC5THotU9V+khz1qVpCWGjyRkeaund5WcZEKDikJLUmH4dtJ1KIoE+KA1Nq+VPuEH tbuHDBe8ODVwFNGVJMVBsJkx0RbU+mJw2kaLvCF0SnrtS7fot4kYfq3Y6aQ6Q3M5W+HL +kQ1btmh27L6EERNl6NP4F2VmieEM36dfG5J/G5DdcBDJgIl0bitydlDllDjYbmcIQY2 +eKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WfJj+TEO; 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 w22si4024326edv.31.2020.06.19.09.09.20; Fri, 19 Jun 2020 09:09:42 -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=WfJj+TEO; 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 S2405548AbgFSQGo (ORCPT + 99 others); Fri, 19 Jun 2020 12:06:44 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:29615 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2405550AbgFSQGA (ORCPT ); Fri, 19 Jun 2020 12:06:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592582759; 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=lYOPBG0iFD9F9VjgENlAdm0PiHZqNHDJn1sXF2V/+vk=; b=WfJj+TEO1ygBEwZSujB+norQqe9WEpjbEJjI1cWX7wbvsk3qkA7jXn9JlbB1z1Mrx/ggyG TsO5NDPnOLYzJJcyvJzON59Xe7eDc+0a8quSFJq+yCQEP5R07Rh2qiRN/akHYK1JgVvjiZ hd7N1pKUqzhGUFUji62bi0dqo4KmgCA= 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-319-VcBl5moCO5CqKC8-vuhoEg-1; Fri, 19 Jun 2020 12:05:58 -0400 X-MC-Unique: VcBl5moCO5CqKC8-vuhoEg-1 Received: by mail-qt1-f198.google.com with SMTP id s30so4383590qts.18 for ; Fri, 19 Jun 2020 09:05:58 -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=lYOPBG0iFD9F9VjgENlAdm0PiHZqNHDJn1sXF2V/+vk=; b=kjJ4mbsWkBp+r25vDaYfw7Tg0Xl5DZtY92qX5o67v2kuDU0oMnLP5G24eU1H53SJ7e LJtkYuxKI02/CldYREYm1wWRMRt+KRzOXrVd3aTYEuoGl1LYmBHPmydwr5vVWLtnIiKL pUm8PH8Kt6sJ8U2xBXoeUs0C06DwSmpbjU3mpUetzhYXHtvCsLS1Y1xV0TZuuoPwQq6U itwwIsXqjrU1vuS0yljD10HK/YlduRLLaGps4cTYxQp8RDDvsBaIURySybu7FLGIG0e9 AebY6+zluaDQbfIkja3T9dIdHUwbFd8vl7Jf0hcaVPCuqguf3qKUFOLrNPjLzHRd0Gn5 iuMg== X-Gm-Message-State: AOAM531qSlfavCk9aIGiFV2RBWzevMggYwmIyAdXI2id0pboc15E5Nak 1ZIhHE+tqeIUXq4MTYK4NdCrV6E0ynDccKMIxuBVfeK60p9Eh4Z33dY0E8/ZvyxHvs30bKRYxpZ y/vT+vMA9yzDm1HjED4vLlqpK X-Received: by 2002:aed:29e6:: with SMTP id o93mr4023506qtd.135.1592582757406; Fri, 19 Jun 2020 09:05:57 -0700 (PDT) X-Received: by 2002:aed:29e6:: with SMTP id o93mr4023464qtd.135.1592582756856; Fri, 19 Jun 2020 09:05:56 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id g11sm6412604qkk.123.2020.06.19.09.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 09:05:56 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Gerald Schaefer , peterx@redhat.com, Andrew Morton , Andrea Arcangeli , Will Deacon , Michael Ellerman , Linus Torvalds , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org Subject: [PATCH 09/26] mm/m68k: Use general page fault accounting Date: Fri, 19 Jun 2020 12:05:21 -0400 Message-Id: <20200619160538.8641-10-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200619160538.8641-1-peterx@redhat.com> References: <20200619160538.8641-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 general page fault accounting by passing regs into handle_mm_fault(). It naturally solve the issue of multiple page fault accounting when page fault retry happened. Add the missing PERF_COUNT_SW_PAGE_FAULTS perf events too. Note, the other two perf events (PERF_COUNT_SW_PAGE_FAULTS_[MAJ|MIN]) were done in handle_mm_fault(). CC: Geert Uytterhoeven CC: linux-m68k@lists.linux-m68k.org Signed-off-by: Peter Xu --- arch/m68k/mm/fault.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c index 2db38dfbc00c..983054d209bc 100644 --- a/arch/m68k/mm/fault.c +++ b/arch/m68k/mm/fault.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -85,6 +86,8 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, if (user_mode(regs)) flags |= FAULT_FLAG_USER; + + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); retry: down_read(&mm->mmap_sem); @@ -135,7 +138,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, * the fault. */ - fault = handle_mm_fault(vma, address, flags, NULL); + fault = handle_mm_fault(vma, address, flags, regs); pr_debug("handle_mm_fault returns %x\n", fault); if (fault_signal_pending(fault, regs)) @@ -151,16 +154,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, BUG(); } - /* - * Major/minor page fault accounting is only done on the - * initial attempt. If we go through a retry, it is extremely - * likely that the page will be found in page cache at that point. - */ if (flags & FAULT_FLAG_ALLOW_RETRY) { - if (fault & VM_FAULT_MAJOR) - current->maj_flt++; - else - current->min_flt++; if (fault & VM_FAULT_RETRY) { flags |= FAULT_FLAG_TRIED; -- 2.26.2