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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 51D6DC433DF for ; Mon, 15 Jun 2020 21:35:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FCE72071A for ; Mon, 15 Jun 2020 21:35:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CkDjT010"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gVPACN6x" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FCE72071A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=68c3qKnuHDtDPEQ33vdbnto/Jmgp7zRYZyZT66mWq9A=; b=CkDjT010zWoOej PldLcn5Jw3y12GDeGedoNhjAnfR8iWkibNt02XAk30toIyddWpKAz+uCNHx7N0HIj8J0B+sv9mL3B EodtrpxAQtoRpczba2pJt53FVsY+SuMeEuUZMOLbk4P6OC1LTsMcCSWbYCRyfwfY+ro0p7dkA6SDH D4sCnpDo6J87I+PK1Ohr0n8j84fe34CpSVLhwSq6gD9yzfqQXPCqtQyt1KbY2RyqnPeyFTV+l8Opl DNGIwNIoe4CQAssdmdx1xoP2g9fvGegiC3X/Rqm3KMkZWIxhFTuk+yqj3eao2JHlVI/adLaWuSp/R +slcpHQ4iJxbWlpPm4Qg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jkwkf-0007Wy-8G; Mon, 15 Jun 2020 21:34:45 +0000 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120] helo=us-smtp-1.mimecast.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jkwka-0007VW-H7 for linux-arm-kernel@lists.infradead.org; Mon, 15 Jun 2020 21:34:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592256876; 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=ItwxuioZVdA5XdCXR1QbAewm4+8qdb0KbH1lb+9ehrA=; b=gVPACN6xO1SeIGsjRKFWvtdrnZBydlA/xLaXlBTA9ukZGl8rrSHTnjN2uogdd2Fc4Dt43t N034oGy0lR/F8iU1msOQSncDNnrtFpLzDG+Yj7bkEUSC/23fQh5XZcOAkeqq2c9/GUp5z8 vlzphSUVDu2xnhW42LAOptOJw/OIneY= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-272-YWDA7cnDPtKmx8J1vIQAOw-1; Mon, 15 Jun 2020 17:34:34 -0400 X-MC-Unique: YWDA7cnDPtKmx8J1vIQAOw-1 Received: by mail-qt1-f199.google.com with SMTP id l26so15117237qtr.14 for ; Mon, 15 Jun 2020 14:34:34 -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=ItwxuioZVdA5XdCXR1QbAewm4+8qdb0KbH1lb+9ehrA=; b=BkjwR2iqSmc7AvtTJxupOJRcaiU4zPxd7bqjHKD8WNlL4cBndIXLXw5tnoznqBJAG5 +1chc42JR/QG+i647NwV8/oq2wfzVMK1kE2z4q1k5DT2H7wK95J8f6T7OBpqUf768RYe s1vK7OZHdYGiO+SdujpwJX7v5IHFsgtCv9jiCbDI550b2iC7JZCMNJHcZcALqDb9Aas7 K2iSzD0W4aBOV28Av3iJWFIWGUQA3ALLED18wRkrdGwf2bPLhVNsQIx8q7mpPSDIo+iq YKHgluapMb8yhiRXwpcYTyCDIr9MpnyNlauMpaCixunkxeMfJTTvSHatOlXq43Azm1To 4xHQ== X-Gm-Message-State: AOAM533VGElNeZuyOICem0e1B7zNtsGpMF3y20YPZv/VDun08ummFbwg on9XVTjb3qe609cO1gTualbsHp0w2DTEB3rllg9Zs29VVpr/ENWmRkCsv9dr+yQ5CnkESIio6ye 4DbrpmDyRquXewDLluiPFLCzvRBbpaVDy88Q= X-Received: by 2002:a0c:ed31:: with SMTP id u17mr25540574qvq.117.1592256874108; Mon, 15 Jun 2020 14:34:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0iHGiHde51cucRTUPE7NzfM/1jQRbNlFV4ChXmFExBXup/Ay4TPRKGywEeToUwHIWcL2Psg== X-Received: by 2002:a0c:ed31:: with SMTP id u17mr25540552qvq.117.1592256873805; Mon, 15 Jun 2020 14:34:33 -0700 (PDT) Received: from xz-x1 ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id f30sm12961493qtb.9.2020.06.15.14.34.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2020 14:34:33 -0700 (PDT) Date: Mon, 15 Jun 2020 17:34:31 -0400 From: Peter Xu To: Gerald Schaefer Subject: Re: Possible duplicate page fault accounting on some archs after commit 4064b9827063 Message-ID: <20200615213431.GC111927@xz-x1> References: <20200610174811.44b94525@thinkpad> <20200610165023.GA67179@xz-x1> MIME-Version: 1.0 In-Reply-To: <20200610165023.GA67179@xz-x1> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200615_143440_634928_CEA639BF X-CRM114-Status: GOOD ( 23.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Heiko Carstens , linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, linux-hexagon@vger.kernel.org, Ley Foon Tan , Andrea Arcangeli , linux-xtensa@linux-xtensa.org, linux-um@lists.infradead.org, linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, Guan Xuetao , linux-arm-kernel@lists.infradead.org, Michal Simek , Nick Hu , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, Linus Torvalds Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 10, 2020 at 12:50:23PM -0400, Peter Xu wrote: > On Wed, Jun 10, 2020 at 05:48:11PM +0200, Gerald Schaefer wrote: > > Hi, > > Hi, Gerald, > > > > > Some architectures have their page fault accounting code inside the fault > > retry loop, and rely on only going through that code once. Before commit > > 4064b9827063 ("mm: allow VM_FAULT_RETRY for multiple times"), that was > > ensured by testing for and clearing FAULT_FLAG_ALLOW_RETRY. > > > > That commit had to remove the clearing of FAULT_FLAG_ALLOW_RETRY for all > > architectures, and introduced a subtle change to page fault accounting > > logic in the affected archs. It is now possible to go through the retry > > loop multiple times, and the affected archs would then account multiple > > page faults instead of just one. > > > > This was found by coincidence in s390 code, and a quick check showed that > > there are quite a lot of other architectures that seem to be affected in a > > similar way. I'm preparing a fix for s390, by moving the accounting behind > > the retry loop, similar to x86. It is not completely straight-forward, so > > I leave the fix for other archs to the respective maintainers. > > Sorry for not noticing this before. The accounting part should definitely be > put at least into a check against fault_flag_allow_retry_first() to mimic what > was done before. And I agree it would be even better to put it after the retry > logic, so if any of the page faults gets a major fault, it'll be accounted as a > major fault which makes more sense to me, just like what x86 is doing now with: > > major |= fault & VM_FAULT_MAJOR; > > I'm not sure what's the preference of the arch maintainers, just let me know if > it's preferred to use a single series to address this issue for all affected > archs (or the archs besides s390), then I'll do. To make sure this won't fall through the cracks... I'll give it a shot with a single series to address this issue for all archs. Although it might not be easy to do accounting directly in handle_mm_fault(), it might be still a chance to introduce a helper so the accounting can be done in general code. Thanks, -- Peter Xu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel