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 96C43C433E0 for ; Wed, 10 Jun 2020 16:52:34 +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 615682067B for ; Wed, 10 Jun 2020 16:52:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="p5AkIAQd"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LIQhiR/L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 615682067B 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=JnStK8XD5XsEAA4ohHbnjccDKttfrgK4x4wstCKDU8k=; b=p5AkIAQdLv1CPh JCfLCSoYhnVyf/jRIeADYx2flRaY0FhE03qH0C1W2pCwjGIaV5YUleHXCzuTscuQUOi/jbOFDXPlR 5/k83K0z4tATGE0FjD8LbafMlWXA+fVEF4BnnvofGQzZ1MmIYWyF/1Era/L7JySBZqhnDC2XIeNRr ntOqBR90p4wsme4U3ZflR4gYelokJ2R06S3+NDWyT/RIv/zhhq7eWyOuwcCDd7+oqZnoPKdNYq7VG 6kmk0t1Lbpi3/bDZTN6vzblk0eEyFZMl7wU/aH6yMfl0XpEztdTxKSO8UNJrjYnKKNkQD1aTORpxo BSEgeVEqED7vsbg6s3jg==; 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 1jj3xj-0006bl-VC; Wed, 10 Jun 2020 16:52:27 +0000 Received: from us-smtp-2.mimecast.com ([205.139.110.61] helo=us-smtp-delivery-1.mimecast.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jj3xg-0006aZ-Kb for linux-arm-kernel@lists.infradead.org; Wed, 10 Jun 2020 16:52:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591807942; 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=EMwUauau342Zml1K34QLPe12sp1DuwpV44r+JLoVGLk=; b=LIQhiR/LoXbRxeitE2BTaGN1RrZbtBiVeHkyNNFh2w7ArnVozYeAE3DslXJmIGSMoiNz+3 MDSnQKCug0sHl5iq0HEU2cqH8y9hKXXebT9OSXytJf3O+SRwGuZudpeNIHw8/r50xc97ct OiF/mnghH4V2mn3IRMknLCbhZGx/avk= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-197-M314Va8EMQ6FVSPy5g449g-1; Wed, 10 Jun 2020 12:50:28 -0400 X-MC-Unique: M314Va8EMQ6FVSPy5g449g-1 Received: by mail-qv1-f72.google.com with SMTP id v1so2307283qvx.8 for ; Wed, 10 Jun 2020 09:50:27 -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=EMwUauau342Zml1K34QLPe12sp1DuwpV44r+JLoVGLk=; b=YhJvC7qI1kM9UZ9TW6gt8ts7UOb3M3j3ZM+Teltj0zugx9Aqt8scrdcEgwxV6ZyuMP sqMQQHG56KiajF6/vXHmhuTnv9VkrJgNapDSrE6VjHtNidVjrwXs4ZlSPHjtWNYiAfXy JDtohOqAWsFC61RFQhssr/zvXkOQRbIFz1I0vUJCjHeshLqODTD7ktB6Oq0NKGhABoCa iH9Rovt9uG3E+az4U+pgUyXExC9dS+fkjXb730KkJ5lM81hs23QPfiYxTaNcEZrXD5j4 ZJEoN19YhBGiFC5Uw1PcRVc57O+Q+oPimpFdoEedGpH28AakdWtLpvSeJXXT2bqD+l4V DE6Q== X-Gm-Message-State: AOAM533zrhkm/vl3R2E70K3ogHg25uudGTks4HrjQEFTzNrZJYsvYzK1 I+tByYAXcU9qdezDGAozdNIESSPDxG3ksc8pLz/mPTJzWTl1Iu9H3moLqf+dugf8u5IyK4BfN56 qwpaB9RDvS/F+4AeWGpASU1dLx04n/2MszwU= X-Received: by 2002:a37:9cc7:: with SMTP id f190mr3987567qke.236.1591807826875; Wed, 10 Jun 2020 09:50:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyn20TLNz7hD3Ni4blZzJN/2PX0jI8mrO6z2/UHNbD+ObHKXkY/kSbOK73eCMc/XFP0Ereokw== X-Received: by 2002:a37:9cc7:: with SMTP id f190mr3987535qke.236.1591807826580; Wed, 10 Jun 2020 09:50:26 -0700 (PDT) Received: from xz-x1 ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id 207sm149672qki.134.2020.06.10.09.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 09:50:25 -0700 (PDT) Date: Wed, 10 Jun 2020 12:50:23 -0400 From: Peter Xu To: Gerald Schaefer Subject: Re: Possible duplicate page fault accounting on some archs after commit 4064b9827063 Message-ID: <20200610165023.GA67179@xz-x1> References: <20200610174811.44b94525@thinkpad> MIME-Version: 1.0 In-Reply-To: <20200610174811.44b94525@thinkpad> 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-20200610_095224_757110_7A834962 X-CRM114-Status: GOOD ( 17.74 ) 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 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. Thanks! -- Peter Xu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel