From patchwork Fri Jun 9 01:21:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 105211 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp653246vqr; Thu, 8 Jun 2023 18:43:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5xa0lOQR6UZ5uL2dNpXXEebMw8+IU1dxAO5PSycR+jaJHg3afqS2IeC0hA9im5j3FTexlC X-Received: by 2002:a92:c644:0:b0:33b:7584:d60a with SMTP id 4-20020a92c644000000b0033b7584d60amr275218ill.12.1686275019188; Thu, 08 Jun 2023 18:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686275019; cv=none; d=google.com; s=arc-20160816; b=qbadmBMyc/9MWoTy9h5n0Uq5AwgYSeqv8uCCpv6VSjfxXDeuLalH1wUH1B+NvIneV2 CGSmv1FMc8cOPMr6bMSg8wcjik0GSuhrxKx2mvuXs9koizJgt4inxzTlvKgODiu8JShj isP/zshquZTC4vb4MQwCNdCKeG37cN9Wfe4CWxEPvDuJM+ClwpkNY8QnG0H5DQsm2STP NEtZMxfCkTR/+WFWxHplFe2y/8lP8amtjA7sYWADCz6Jk/+PlCY+9leOTVNec7rrpuSI TrmUT+nA1k+le3lspGP4JqUahDYtgy3YUWWGZBnoCBusmLhpG6QxRuPX/fQmIM37VPof j4OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=ngswcYXh32wJZMu4ey5160LWyE599vrHnWvZmx6kKak=; b=faafljRLZbA94vQVYwAy17331IcwSv3zqOk1p27a32RyNV3uRajM/bQiwmUiyZ30od Uojit19qqV7N/+a+BgwaHwTWKvwLBWhu70zP+ouObofsuE9hKxtocVFL95YvSWI57Kka am81qjqGxo6IwUtfArRflaG/eWzhsO4wD0sgv3MIuTtDzQkrXY7VOXNraJXvNRC6WTRY K9ANW3Wr53AVG6LqjVrOs27PA6U1JwprTUHB/MZIOfekCKKGo3xAwHY4tr7ivTRwVqeZ CfZLdBSskaJN3Hhq4rFzwI1FZH5lvOSzqRgTPHd0LTRtuyI9NkELsrTws7sVOkCN1PDf iTcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=DCQmA7jy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j191-20020a638bc8000000b00536e63c8643si1803321pge.558.2023.06.08.18.43.24; Thu, 08 Jun 2023 18:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=DCQmA7jy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237660AbjFIBV7 (ORCPT + 99 others); Thu, 8 Jun 2023 21:21:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237618AbjFIBVr (ORCPT ); Thu, 8 Jun 2023 21:21:47 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3F611FDF for ; Thu, 8 Jun 2023 18:21:46 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-bb3d122a19fso1262860276.0 for ; Thu, 08 Jun 2023 18:21:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686273706; x=1688865706; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=ngswcYXh32wJZMu4ey5160LWyE599vrHnWvZmx6kKak=; b=DCQmA7jyE39MLlNzgNj5Fnvt6VxEVhxfR43nyr9O34TsE/NR89GCRNiD4ZoZdR4Qh/ VVlLGnas01pgDThKof5oMLzzf1GcWd8TwEjNBhNMTY02KeG47WG7BA2R3pdxHonu/WZa V3CvdasgvhS1HvjB0i2UUPMQsDXJR6NqotUE643j7wgPp8AFNy/qFFWZUuLH+fdomurR thKNoJK95KQaiNcwFeztAb+d5ZaqpXtxhvroVgVoxsGEe35huAPILPbeWC7G/RPecM4M XWHbDzBCI7PfoB33hTMYlIVyb/ngBEvTOCi3mr/ilks4HMOz+anwKzwFIqfyaYnbXfBU DGJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686273706; x=1688865706; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ngswcYXh32wJZMu4ey5160LWyE599vrHnWvZmx6kKak=; b=SAiSofQJRF/nlWxzRZhgeBSxX7agnwj6cK7jw0DMVcRHkv/uDdOKkaDHdlUYOsXU1E iSrKvOiZBC5akRbzaoJ/0kEnQDFUgfh4dDMcRwu0JdS2rOSutOeCxhonRpyu6sFl3SUj Z1BSMz1J8H1nQRkQfrmt4bbOk7eSldr73YL36oeISAHHHi9FVPaRZpFmDZ4L0eji5sqo Ie+QMUzBgGflNqCrD2yHM2zRo7o5StC26ZORynPsbVIn+qmzJiKV3UrBJH2M+nFsVhUq m8CvkXq8IAHticA7GuRSsJEjQJFg8j5ZChx7YvrstpZIu0TYIAqf3IAomJkrt6e313nG Puig== X-Gm-Message-State: AC+VfDzg2BTBr4MPnj2kXmzg9Fzd3zjL3g3z7cIn13FLXQ9bvZeb8Qm+ 2O3VLRGITpII4yzfzYofszDgfg== X-Received: by 2002:a25:f501:0:b0:bb3:9255:33e9 with SMTP id a1-20020a25f501000000b00bb3925533e9mr1145250ybe.53.1686273705789; Thu, 08 Jun 2023 18:21:45 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id t12-20020a5b0dcc000000b00bb138b444dcsm586743ybr.36.2023.06.08.18.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 18:21:44 -0700 (PDT) Date: Thu, 8 Jun 2023 18:21:41 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Yang Shi , Mel Gorman , Peter Xu , Peter Zijlstra , Will Deacon , Yu Zhao , Alistair Popple , Ralph Campbell , Ira Weiny , Steven Price , SeongJae Park , Lorenzo Stoakes , Huang Ying , Naoya Horiguchi , Christophe Leroy , Zack Rusin , Jason Gunthorpe , Axel Rasmussen , Anshuman Khandual , Pasha Tatashin , Miaohe Lin , Minchan Kim , Christoph Hellwig , Song Liu , Thomas Hellstrom , Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 12/32] mm/vmalloc: vmalloc_to_page() use pte_offset_kernel() In-Reply-To: Message-ID: <696386a-84f8-b33c-82e5-f865ed6eb39@google.com> References: MIME-Version: 1.0 X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768187514361527076?= X-GMAIL-MSGID: =?utf-8?q?1768187514361527076?= vmalloc_to_page() was using pte_offset_map() (followed by pte_unmap()), but it's intended for userspace page tables: prefer pte_offset_kernel(). Signed-off-by: Hugh Dickins Reviewed-by: Lorenzo Stoakes --- mm/vmalloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 9683573f1225..741722d247d5 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -703,11 +703,10 @@ struct page *vmalloc_to_page(const void *vmalloc_addr) if (WARN_ON_ONCE(pmd_bad(*pmd))) return NULL; - ptep = pte_offset_map(pmd, addr); + ptep = pte_offset_kernel(pmd, addr); pte = *ptep; if (pte_present(pte)) page = pte_page(pte); - pte_unmap(ptep); return page; }