From patchwork Wed Jan 20 17:36:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 12033043 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=-14.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 6348EC433DB for ; Wed, 20 Jan 2021 17:36:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 18DCF23136 for ; Wed, 20 Jan 2021 17:36:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 18DCF23136 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AA17D6B000E; Wed, 20 Jan 2021 12:36:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A79316B0010; Wed, 20 Jan 2021 12:36:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F8046B0012; Wed, 20 Jan 2021 12:36:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0135.hostedemail.com [216.40.44.135]) by kanga.kvack.org (Postfix) with ESMTP id 749C56B000E for ; Wed, 20 Jan 2021 12:36:43 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 411FC180AD837 for ; Wed, 20 Jan 2021 17:36:43 +0000 (UTC) X-FDA: 77726858286.18.snake04_6100f812755c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id F28AA100EDBF7 for ; Wed, 20 Jan 2021 17:36:42 +0000 (UTC) X-HE-Tag: snake04_6100f812755c X-Filterd-Recvd-Size: 3593 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 17:36:42 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 5004B233EA; Wed, 20 Jan 2021 17:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611164201; bh=nZ0EDBk5rDq2VDhiLnpGwPqd3bpBQursOySVujIsCMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VCUTKTKul7XMKhPhUsZ3RU4YTZs8hTEuZLgYaE/oqPKF3PkCQ80A0PnrSu7LH79y8 RJGsvw9H7y/jbKRPAAJ8xOvUnNljRDEPMk80xckfTEuFPBNHOtL3gXMKjyMz1t8XiQ 3IiMiNjAcWMGwzEYPGls03u3RRLf7wMGP09bGukK3KyWK2eVWgwKc4GAwXZu70cjIM /9A+dliD3NS43Y434oLUAwb61ZSx96AOJpFX97acCjHM7JQo8oALGl15Inz12qehZ7 BC4jXwdTjT5pXoZ6kZgBwYepGeQ7fU5LhKq9JBsTbVpKPA3XxUX07fSmLsYebkSOgV XeWB/VG1Zvfrg== From: Will Deacon To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, Will Deacon , Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , "Kirill A . Shutemov" , Linus Torvalds , Vinayak Menon , Hugh Dickins , Nick Desaulniers , kernel-team@android.com Subject: [PATCH v4 7/8] mm: Use static initialisers for immutable fields of 'struct vm_fault' Date: Wed, 20 Jan 2021 17:36:11 +0000 Message-Id: <20210120173612.20913-8-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210120173612.20913-1-will@kernel.org> References: <20210120173612.20913-1-will@kernel.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: In preparation for const-ifying the anonymous struct field of 'struct vm_fault', ensure that it is initialised using static initialisers. Cc: Kirill A. Shutemov Cc: Linus Torvalds Signed-off-by: Will Deacon Reviewed-by: Nick Desaulniers --- mm/shmem.c | 6 +++--- mm/swapfile.c | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 7c6b6d8f6c39..1b254fbfdf52 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1520,11 +1520,11 @@ static struct page *shmem_swapin(swp_entry_t swap, gfp_t gfp, { struct vm_area_struct pvma; struct page *page; - struct vm_fault vmf; + struct vm_fault vmf = { + .vma = &pvma, + }; shmem_pseudo_vma_init(&pvma, info, index); - vmf.vma = &pvma; - vmf.address = 0; page = swap_cluster_readahead(swap, gfp, &vmf); shmem_pseudo_vma_destroy(&pvma); diff --git a/mm/swapfile.c b/mm/swapfile.c index 9fffc5af29d1..2b570a566276 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1951,8 +1951,6 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd, si = swap_info[type]; pte = pte_offset_map(pmd, addr); do { - struct vm_fault vmf; - if (!is_swap_pte(*pte)) continue; @@ -1968,9 +1966,12 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd, swap_map = &si->swap_map[offset]; page = lookup_swap_cache(entry, vma, addr); if (!page) { - vmf.vma = vma; - vmf.address = addr; - vmf.pmd = pmd; + struct vm_fault vmf = { + .vma = vma, + .address = addr, + .pmd = pmd, + }; + page = swapin_readahead(entry, GFP_HIGHUSER_MOVABLE, &vmf); }