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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 88797C433E5 for ; Tue, 7 Jul 2020 22:51:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F5602075B for ; Tue, 7 Jul 2020 22:51:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HRq0kaPu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F5602075B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A90A76B00CD; Tue, 7 Jul 2020 18:51:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 92E5E6B00D0; Tue, 7 Jul 2020 18:51:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55A166B00CE; Tue, 7 Jul 2020 18:51:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0182.hostedemail.com [216.40.44.182]) by kanga.kvack.org (Postfix) with ESMTP id 283406B00CD for ; Tue, 7 Jul 2020 18:51:04 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E649E180AD806 for ; Tue, 7 Jul 2020 22:51:03 +0000 (UTC) X-FDA: 77012776806.15.care51_010d12126eb8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id B35EE1814B0CA for ; Tue, 7 Jul 2020 22:51:03 +0000 (UTC) X-HE-Tag: care51_010d12126eb8 X-Filterd-Recvd-Size: 5959 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jul 2020 22:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594162262; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kk36RboWNwg3s7a93FkyA+KGsd0nhQw91NIAXCwhVNw=; b=HRq0kaPu0cQSHO7RS9sOxgmHCZf+JIsRgRDPCXWyV8gNdLGiOKWhHBw996i5J7+Qih+CbD gVgdLZFp23wSEA2i1WNstMnd90i0C2fpzpauuBMFIch+kXjhvxRPsBl3813FvjPGIhCKAp gtwD/Q6lywuuiTiEIYux9f0WJCVttVs= 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-35-Qcy_-39MMXWpKusagGyWmA-1; Tue, 07 Jul 2020 18:51:01 -0400 X-MC-Unique: Qcy_-39MMXWpKusagGyWmA-1 Received: by mail-qk1-f197.google.com with SMTP id f79so23562638qke.9 for ; Tue, 07 Jul 2020 15:51:01 -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=Kk36RboWNwg3s7a93FkyA+KGsd0nhQw91NIAXCwhVNw=; b=h7JAzB1GNpaL0cktLqXMzcMuj3D/ZpKYZVy/SONcoEj8K9p98EmLbTnJ51EXN5wypw ox3XGhaW55MYN6SA5lMmvoj3kUN7VxQmILT/RQ7OvwzksHqNZJ/I/4ZLX50+73u4u941 n7skK5CnwaxzIr/MCzOFf4et4qj5qtiJuiI0nMLUpqgq4MGFN1ZQaM/udrdjPaYtnkqI F0y93/B4R2CfChBDc6w9adHT4DmogvEO7jfRNRwzMi8hOEa9r/zkxRgnNC49Lge+QCPK QpQ+CuK/HKtrYJXKpHPkphiAY7b8I6TKBkLmmNuiZjOIkpL9qhlTdEy6kXQ9Cs3tK2YI SZsQ== X-Gm-Message-State: AOAM532peitqUJqJkiobzZoZOuWNjPSKZSHau0L5/CE2xDlc19XTFHdv q3iYYJ05pbjUL0zAVMf6KnF3UJnSzwCr+QrjwgwKo3N6bLLpl0SMznd04Nwu0OedCww2pqRN9Eg f2O5ET0HpeZ0= X-Received: by 2002:a37:6190:: with SMTP id v138mr53385951qkb.121.1594162260752; Tue, 07 Jul 2020 15:51:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTUthE4moACxwTPkskLMlZ3H+JQN0LXa92kSVZuEtlyr0Utc0VYzJmCu+EUJvBvgJauPP9DA== X-Received: by 2002:a37:6190:: with SMTP id v138mr53385933qkb.121.1594162260533; Tue, 07 Jul 2020 15:51:00 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id j16sm26267642qtp.92.2020.07.07.15.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2020 15:50:59 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Gerald Schaefer , Linus Torvalds , peterx@redhat.com, Andrew Morton , Will Deacon , Andrea Arcangeli , David Rientjes , John Hubbard , Michael Ellerman , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" Subject: [PATCH v5 22/25] mm/x86: Use general page fault accounting Date: Tue, 7 Jul 2020 18:50:18 -0400 Message-Id: <20200707225021.200906-23-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200707225021.200906-1-peterx@redhat.com> References: <20200707225021.200906-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: B35EE1814B0CA X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use the general page fault accounting by passing regs into handle_mm_faul= t(). CC: Dave Hansen CC: Andy Lutomirski CC: Peter Zijlstra CC: Thomas Gleixner CC: Ingo Molnar CC: Borislav Petkov CC: x86@kernel.org CC: H. Peter Anvin Signed-off-by: Peter Xu --- arch/x86/mm/fault.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 0adbff41adec..471cfd162b30 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -1139,7 +1139,7 @@ void do_user_addr_fault(struct pt_regs *regs, struct vm_area_struct *vma; struct task_struct *tsk; struct mm_struct *mm; - vm_fault_t fault, major =3D 0; + vm_fault_t fault; unsigned int flags =3D FAULT_FLAG_DEFAULT; =20 tsk =3D current; @@ -1291,8 +1291,7 @@ void do_user_addr_fault(struct pt_regs *regs, * userland). The return to userland is identified whenever * FAULT_FLAG_USER|FAULT_FLAG_KILLABLE are both set in flags. */ - fault =3D handle_mm_fault(vma, address, flags, NULL); - major |=3D fault & VM_FAULT_MAJOR; + fault =3D handle_mm_fault(vma, address, flags, regs); =20 /* Quick path to respond to signals */ if (fault_signal_pending(fault, regs)) { @@ -1319,18 +1318,6 @@ void do_user_addr_fault(struct pt_regs *regs, return; } =20 - /* - * Major/minor page fault accounting. If any of the events - * returned VM_FAULT_MAJOR, we account it as a major fault. - */ - if (major) { - tsk->maj_flt++; - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address); - } else { - tsk->min_flt++; - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address); - } - check_v8086_mode(regs, address, tsk); } NOKPROBE_SYMBOL(do_user_addr_fault); --=20 2.26.2