Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp940977imu; Tue, 11 Dec 2018 09:54:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/WJyVGM0JJpKEmk81FfX5R5V2WhAk98jHUELOEy4gZaPO4U1hi469P5GVMB7hZPtgn3VL6V X-Received: by 2002:a63:6506:: with SMTP id z6mr15303283pgb.334.1544550888563; Tue, 11 Dec 2018 09:54:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544550888; cv=none; d=google.com; s=arc-20160816; b=eMF7xuDDlBp/MYppBaLN1KJFK26oRzQA1itKQETRpake4+ZlZ9iCTb2Tl5UB5Pe7hZ 172xieo2fPqLxF637Rl3zvIQht2PkCxcRtwZ272SD+ouivqVKHIZRO14z6/Nnk4OPnDG YTj4/xlZrI+H2ZUPGWfyRUEae7rw6CWk4XTvhscpU0t8DT3TU1bxHVRcAo+tNtAd2x7e jlA3vsTi91JKj0JmWYCJDB+5l5qn5Vlr/BZVsvkY/vn7y4syT7QeopcSgAdmgFvEJejR dbs8lyeZlNpcfV7qa76q0tVqcwqtBPyQJ7A/vD86yYB2eqkN2Gl7Qf4k92JMRQrB6tUA dCVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature; bh=6+vkcIGN+YamTKpLFC2eJaZY1L81O/2cuEfVUcvimSs=; b=y/j4QFiilR6UDrxHeNq19LXcYrAKShv06Ikkg1LuGfg4c1ttF0PQTn8DcpkoxSK7tO /TG//0ll2hzBNnH55CAvOg9475l8erAsT6F52uu3GQNQYkKPNqHoPowp+fmF3lGWfe8S qOotvgl7Cs5hWgZRlVoWnN0bkRkTfLgKH6Dfv0nRUU97zlc6j4/pOXFhM+TOqOsLGKx8 I1F7GVrxm1lpaevKY7J2tADsi9UURtHiuxv8sPXKmhWAI6qQpD+STLBr2DGJoYRsYS7/ onwPOj9hR/w+aj42ch4ah9J/rv2+5F05dONuZjHjQa+tA/N+AYPuHjp/bcS1sBH5tzmy jxHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=onkGNEpE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b137si12753717pga.394.2018.12.11.09.54.33; Tue, 11 Dec 2018 09:54:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=onkGNEpE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726999AbeLKRiX (ORCPT + 99 others); Tue, 11 Dec 2018 12:38:23 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:41453 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbeLKRiK (ORCPT ); Tue, 11 Dec 2018 12:38:10 -0500 Received: by mail-yw1-f68.google.com with SMTP id f65so5768067ywc.8 for ; Tue, 11 Dec 2018 09:38:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=6+vkcIGN+YamTKpLFC2eJaZY1L81O/2cuEfVUcvimSs=; b=onkGNEpEitvIeZ44/RIcuW782ouZN+AIDExGya0oL4/MMxV/w9XB86uQL5NP8YT3Uh Ldt9XIc+hhNKBWSRlYXdXI/xf/dA0+YR11iXs9YVxvs0CAFtb7h1PK8GVdKs0avLVv4f XuIo7BsuQO9iinP2mFVQm6jBbdUi+jcVXfSbPz6XkpP0z9tKdi9uBlIGfX3HTkN3qAQ9 ewSm38NfjZyTBLQhZT4diQ/BZOEyCi73uu5QRkYSA+10SCWr/TxJRu1zrKNDLhZtnWS7 QJ5APV9ViQ29QhQ7oYaeWLlefesxlE6NFjt9fqmZVh1FAT1/kdIOoSz18J6jw0B5lvW8 q+Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=6+vkcIGN+YamTKpLFC2eJaZY1L81O/2cuEfVUcvimSs=; b=N6B3r/c8PXFvZC3WNkb0VMaahLcprOTURwwlMVGaWfHTwlpdWPaistqm1OEMHFbgyl /kXujSnFBrHMBjI6p98IluiuSEjh6dIic185KXPC/M4fpo7Jmj6P/mw3q5TKh4f2R1kX UOFMI9ITOkALw7VDBu/fuf9qj0gUeH35FfiTWpbzDk6sDoJDh4thD9WN7xYVRR8V9H0v AgcaJmJfrULyJ18kzvYIiQCv1XO425TZfy1qL65CpmJZlBFfReKDoCSm2j8zMuSEnpx7 TXvebIpGL8QIdwZij/P4JuqsUxr2UX2WLfgK57yF54+h2zeFrj1bmDOVsDmmYIZ/TgJ1 bX4A== X-Gm-Message-State: AA+aEWYsRHrlD7wgfFC2VRhASySMV7KgDnESVUrAgm0SjGvr5yMum8of mG5WIq2eOgONYmrQC48CCpNEEQ== X-Received: by 2002:a81:33c4:: with SMTP id z187mr17904067ywz.294.1544549889022; Tue, 11 Dec 2018 09:38:09 -0800 (PST) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id m67sm4619269ywb.54.2018.12.11.09.38.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Dec 2018 09:38:08 -0800 (PST) From: Josef Bacik To: kernel-team@fb.com, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, tj@kernel.org, david@fromorbit.com, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, riel@redhat.com, jack@suse.cz Subject: [PATCH 2/3] filemap: pass vm_fault to the mmap ra helpers Date: Tue, 11 Dec 2018 12:38:00 -0500 Message-Id: <20181211173801.29535-3-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181211173801.29535-1-josef@toxicpanda.com> References: <20181211173801.29535-1-josef@toxicpanda.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All of the arguments to these functions come from the vmf, and the following patches are going to add more arguments. Cut down on the amount of arguments passed by simply passing in the vmf to these two helpers. Signed-off-by: Josef Bacik --- mm/filemap.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 03bce38d8f2b..8fc45f24b201 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2309,20 +2309,20 @@ EXPORT_SYMBOL(generic_file_read_iter); * Synchronous readahead happens when we don't even find * a page in the page cache at all. */ -static void do_sync_mmap_readahead(struct vm_area_struct *vma, - struct file_ra_state *ra, - struct file *file, - pgoff_t offset) +static void do_sync_mmap_readahead(struct vm_fault *vmf) { + struct file *file = vmf->vma->vm_file; + struct file_ra_state *ra = &file->f_ra; struct address_space *mapping = file->f_mapping; + pgoff_t offset = vmf->pgoff; /* If we don't want any read-ahead, don't bother */ - if (vma->vm_flags & VM_RAND_READ) + if (vmf->vma->vm_flags & VM_RAND_READ) return; if (!ra->ra_pages) return; - if (vma->vm_flags & VM_SEQ_READ) { + if (vmf->vma->vm_flags & VM_SEQ_READ) { page_cache_sync_readahead(mapping, ra, file, offset, ra->ra_pages); return; @@ -2352,16 +2352,16 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma, * Asynchronous readahead happens when we find the page and PG_readahead, * so we want to possibly extend the readahead further.. */ -static void do_async_mmap_readahead(struct vm_area_struct *vma, - struct file_ra_state *ra, - struct file *file, - struct page *page, - pgoff_t offset) +static void do_async_mmap_readahead(struct vm_fault *vmf, + struct page *page) { + struct file *file = vmf->vma->vm_file; + struct file_ra_state *ra = &file->f_ra; struct address_space *mapping = file->f_mapping; + pgoff_t offset = vmf->pgoff; /* If we don't want any read-ahead, don't bother */ - if (vma->vm_flags & VM_RAND_READ) + if (vmf->vma->vm_flags & VM_RAND_READ) return; if (ra->mmap_miss > 0) ra->mmap_miss--; @@ -2418,10 +2418,10 @@ vm_fault_t filemap_fault(struct vm_fault *vmf) * We found the page, so try async readahead before * waiting for the lock. */ - do_async_mmap_readahead(vmf->vma, ra, file, page, offset); + do_async_mmap_readahead(vmf, page); } else if (!page) { /* No page in the page cache at all */ - do_sync_mmap_readahead(vmf->vma, ra, file, offset); + do_sync_mmap_readahead(vmf); count_vm_event(PGMAJFAULT); count_memcg_event_mm(vmf->vma->vm_mm, PGMAJFAULT); ret = VM_FAULT_MAJOR; -- 2.14.3