From patchwork Mon Sep 21 20:39:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salyzyn X-Patchwork-Id: 7233711 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1BE6EBEEC1 for ; Mon, 21 Sep 2015 20:45:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 28D692080F for ; Mon, 21 Sep 2015 20:45:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 474542080E for ; Mon, 21 Sep 2015 20:45:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ze7tl-0000TW-6P; Mon, 21 Sep 2015 20:41:17 +0000 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ze7tf-0000P4-MK for linux-arm-kernel@lists.infradead.org; Mon, 21 Sep 2015 20:41:12 +0000 Received: by pacfv12 with SMTP id fv12so128700839pac.2 for ; Mon, 21 Sep 2015 13:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20120917; h=from:to:cc:subject:date:message-id; bh=yNyjZsxAEQzGfB1ve9lq7+18V7hifJ+wiJj78ho8wr8=; b=X19wVui/DqR/e4SA4n2A7FATu5TVGGdUBtWOY5eNtEA8qQtEsZyazN2w20zIdm0wdp +hMFecSqOcYZdNwN9SgUziWBi+kieWgBAJf7hGs9llIi+1g91YwSB7LeU43ewfsR++7q /yEH9vJbaRyqjygtrtm2F7ROkADyY8IYBU9aM9/vdIg+tcsPIBb3D538LjDQkycM1+Jl ldSrBDfOw16ViHMGrHJ/pPUga0y7J+R8deFGbexM3jJAXlGLJ9DAFtC+12qlQvnlaSye l6KnNO4RX7KtCCeyJCLi0LDrMQHDS8Yi4w73/JRm3VNd5Uq3haeyVDPknEGiWB6ZQc/k rxIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yNyjZsxAEQzGfB1ve9lq7+18V7hifJ+wiJj78ho8wr8=; b=fB8RsKH5Amb96fH+/HItwq5KWxV1h6he1cpiT30ahkKkxPlnFZ/WWKzoEjJkFwSqaH T25zlSNj82EL9V60XJG077ca+cz3vsZyj0VZXSPuK8O6G4j4rK954uThLVBDRGlEXIQK FvONXHfLbkKbky4PCOlwtrOpbATQZOBuMKhdBcWyv5967lz0PAmQ/PcI30NIxQlfE0I6 uIqxkixPQa6rVk8tikmEKZKEEe/77WoxPFTnseJm5zGBRcrbowY5cKFeDGTai6aqHKBR lIIxLCiFcDmIqoQeQ9voW2QlW9+jbhL5rd2I/MPzyKidGvLuuAoi7KnderfRYJbVYMh7 YCqg== X-Gm-Message-State: ALoCoQkO4Lba1ADru+4mjeC8eKatSEOplqBfEsm7l4uDaxB6sAK1ugqhynasUNnCP2HURXu7lLdr X-Received: by 10.67.8.106 with SMTP id dj10mr27094266pad.123.1442868049446; Mon, 21 Sep 2015 13:40:49 -0700 (PDT) Received: from virago.mtv.corp.google.com ([172.22.122.154]) by smtp.gmail.com with ESMTPSA id ql5sm26354471pac.46.2015.09.21.13.40.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Sep 2015 13:40:48 -0700 (PDT) From: Mark Salyzyn To: linux-kernel@vger.kernel.org Subject: ARM64 readahead: fault retry breaks mmap file read random detection Date: Mon, 21 Sep 2015 13:39:50 -0700 Message-Id: <1442868028-27055-1-git-send-email-salyzyn@android.com> X-Mailer: git-send-email 2.6.0.rc0.131.gf624c3d X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150921_134111_781018_E053B25D X-CRM114-Status: GOOD ( 12.53 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Rik van Riel , Vladimir Murzin , Catalin Marinas , Shaohua Li , Will Deacon , Mark Salyzyn , David Hildenbrand , Riley Andrews , James Morse , Wu Fengguang , Shaohua Li , Dave P Martin , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Description from commit 45cac65b0fcd ("readahead: fault retry breaks mmap file read random detection") .fault now can retry. The retry can break state machine of .fault. In filemap_fault, if page is miss, ra->mmap_miss is increased. In the second try, since the page is in page cache now, ra->mmap_miss is decreased. And these are done in one fault, so we can't detect random mmap file access. Add a new flag to indicate .fault is tried once. In the second try, skip ra->mmap_miss decreasing. The filemap_fault state machine is ok with it. I only tested x86, didn't test other archs, but looks the change for other archs is obvious, but who knows :) < snip > Yup, arm64 needs this too! Random read improves by 250%, sequential read improves by 40%, and random write by 400% to an eMMC device with dm crypto wrapped around it. Signed-off-by: Mark Salyzyn Signed-off-by: Riley Andrews Cc: Shaohua Li Cc: Shaohua Li Cc: Rik van Riel Cc: Wu Fengguang --- arch/arm64/mm/fault.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index aba9ead..9fadf6d 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -287,6 +287,7 @@ retry: * starvation. */ mm_flags &= ~FAULT_FLAG_ALLOW_RETRY; + mm_flags |= FAULT_FLAG_TRIED; goto retry; } }