Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2558518ybt; Tue, 16 Jun 2020 09:01:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymRjiVhdKQ25xy+yp1rsPldHQ2IsRG7lAPk4IWNTVCE/4AXxs5f6wVd1VhdmfzBfkowZhb X-Received: by 2002:a17:906:3154:: with SMTP id e20mr3527947eje.171.1592323307945; Tue, 16 Jun 2020 09:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592323307; cv=none; d=google.com; s=arc-20160816; b=Tyeqb8YBHi6PIap8BO4FrCFr2u9Dlg7oJO8TJ+Sxp5JM5UoZzs5xZ/gR0lIrl2nhpY ZhLcBF7meviKcbA+MbZXbNQ4i6Gc7xQaWMO7zY3HaukBft7OyqpXMUvAjpn5YwMSiXpA JLB2jgC0V/2pQMxevdY9H6BrWzCeTwVOdpDg+Nv1noD4xiWX3P8UoedIkSQtYuel2bjJ jywLoh7xOrDf8DmWW1+hk0QqjAUMycCekJt3nMKKhsQXmRLx4Gs6+FhL6cKkNqmkgxqc AKtcWxjiWrfFJGG5TfF1GR7nxzgdbAQ8p5TOiseY92ITtI9EBhGDzC7SMTA69YC/eXgb tEJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=XHrAoH+LI/BRyhJglSHREWr3mKJWmTM3i2GrKPn8EfY=; b=QExeusdqZ4spFFvubJ/dKGcO/8anwwJZq+V5TtHYIu1hdsnnnmHK9BX8qvNp8BPHRB 55ywaynryMc+zSYEr0loO+H6vt8p403qPFRoM0jag6SyrF8PwZ38dVYEJEpbTtrYFzie 5MWiuxfXqwRFDTn6Z+yYNXo6idFktKPFrrBzG9J03cgP7I6IJvnvMgRaVDJbZpgVlWEz /9HDuDUBeZS4di5tPmiZ8tPbg4AzqY549t2UaKDNLehOqKAm/5Ob9tttR912TjR107uP UbHH6HEw8F3OYk+X5y/sQfUmWPSFqLdRk60mfjARYs7W98qF2ewV+oXdu+Opnf4oVJPo jZUw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si11647764edl.255.2020.06.16.09.01.24; Tue, 16 Jun 2020 09:01:47 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733079AbgFPP7p (ORCPT + 99 others); Tue, 16 Jun 2020 11:59:45 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52486 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732382AbgFPP7m (ORCPT ); Tue, 16 Jun 2020 11:59:42 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05GFxHG0023277; Tue, 16 Jun 2020 11:59:42 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 31pux0bwar-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 11:59:41 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 05GFxZIv025182; Tue, 16 Jun 2020 11:59:41 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 31pux0bw9c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 11:59:41 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05GFvCiP005113; Tue, 16 Jun 2020 15:59:38 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 31mpe7t9b8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 15:59:38 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05GFxZdT8520138 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Jun 2020 15:59:35 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D0CBA11C058; Tue, 16 Jun 2020 15:59:35 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4956C11C054; Tue, 16 Jun 2020 15:59:35 +0000 (GMT) Received: from oc3871087118.ibm.com (unknown [9.145.3.58]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 16 Jun 2020 15:59:35 +0000 (GMT) Date: Tue, 16 Jun 2020 17:59:33 +0200 From: Alexander Gordeev To: Peter Xu Cc: linux-kernel@vger.kernel.org, Gerald Schaefer , Andrew Morton , Linus Torvalds , Andrea Arcangeli , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linux-s390@vger.kernel.org Subject: Re: [PATCH 19/25] mm/s390: Use mm_fault_accounting() Message-ID: <20200616155933.GA12897@oc3871087118.ibm.com> References: <20200615221607.7764-1-peterx@redhat.com> <20200615222302.8452-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200615222302.8452-1-peterx@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.687 definitions=2020-06-16_04:2020-06-16,2020-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 cotscore=-2147483648 lowpriorityscore=0 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1011 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006160108 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 15, 2020 at 06:23:02PM -0400, Peter Xu wrote: > Use the new mm_fault_accounting() helper for page fault accounting. > > Avoid doing page fault accounting multiple times if the page fault is retried. > > CC: Heiko Carstens > CC: Vasily Gorbik > CC: Christian Borntraeger > CC: linux-s390@vger.kernel.org > Signed-off-by: Peter Xu > --- > arch/s390/mm/fault.c | 21 +++++---------------- > 1 file changed, 5 insertions(+), 16 deletions(-) > > diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c > index dedc28be27ab..8ca207635b59 100644 > --- a/arch/s390/mm/fault.c > +++ b/arch/s390/mm/fault.c > @@ -392,7 +392,7 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access) > unsigned long trans_exc_code; > unsigned long address; > unsigned int flags; > - vm_fault_t fault; > + vm_fault_t fault, major = 0; > > tsk = current; > /* > @@ -428,7 +428,6 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access) > } > > address = trans_exc_code & __FAIL_ADDR_MASK; > - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); > flags = FAULT_FLAG_DEFAULT; > if (user_mode(regs)) > flags |= FAULT_FLAG_USER; > @@ -480,6 +479,7 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access) > * the fault. > */ > fault = handle_mm_fault(vma, address, flags); > + major |= fault & VM_FAULT_MAJOR; > if (fault_signal_pending(fault, regs)) { > fault = VM_FAULT_SIGNAL; > if (flags & FAULT_FLAG_RETRY_NOWAIT) > @@ -489,21 +489,7 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access) > if (unlikely(fault & VM_FAULT_ERROR)) > goto out_up; > > - /* > - * 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) { > - 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); > - } > if (fault & VM_FAULT_RETRY) { > if (IS_ENABLED(CONFIG_PGSTE) && gmap && > (flags & FAULT_FLAG_RETRY_NOWAIT)) { Seems like the call to mm_fault_accounting() will be missed if we entered here with FAULT_FLAG_RETRY_NOWAIT flag set, since it jumps to "out_up"... > @@ -519,6 +505,9 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access) > goto retry; > } > } > + > + mm_fault_accounting(tsk, regs, address, major); > + > if (IS_ENABLED(CONFIG_PGSTE) && gmap) { > address = __gmap_link(gmap, current->thread.gmap_addr, > address); > -- > 2.26.2 >