From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicholas Piggin Subject: Re: [PATCH v2 1/4] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings Date: Tue, 14 Apr 2020 21:31:49 +1000 Message-ID: <1586863573.ufpx8o7f0i.astroid@bobo.none> References: <20200413125303.423864-1-npiggin@gmail.com> <20200413125303.423864-2-npiggin@gmail.com> <20200413133444.GM21484@bombadil.infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2439311AbgDNLdZ (ORCPT ); Tue, 14 Apr 2020 07:33:25 -0400 In-Reply-To: <20200413133444.GM21484@bombadil.infradead.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Matthew Wilcox Cc: Borislav Petkov , Catalin Marinas , "H. Peter Anvin" , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, Ingo Molnar , Thomas Gleixner , Will Deacon , x86@kernel.org Excerpts from Matthew Wilcox's message of April 13, 2020 11:34 pm: > On Mon, Apr 13, 2020 at 10:53:00PM +1000, Nicholas Piggin wrote: >> vmalloc_to_page returns NULL for addresses mapped by larger pages[*]. >> Whether or not a vmap is huge depends on the architecture details, >> alignments, boot options, etc., which the caller can not be expected >> to know. Therefore HUGE_VMAP is a regression for vmalloc_to_page. >>=20 >> This change teaches vmalloc_to_page about larger pages, and returns >> the struct page that corresponds to the offset within the large page. >> This makes the API agnostic to mapping implementation details. >=20 > I'm trying to get us away from returning tail pages from various > functions. How much of a pain would it be to return the head page > instead of the tail page? Well, this is a fix for the interface for HUGE_VMAP stuff so it doesn't really make sense to change the implementation here. If you want to change or make a different API that would be a later patch, no? > Obviously the implementation gets simpler, > but can the callers cope? I've been focusing on the page cache, so I > haven't been looking at the vmalloc side of things at all. Well callers that operate on ioremap today (and vmalloc tomorrow) won't cope, because they're expecting a base page. If you wanted to change it I suspect the way to go would be introduce a new function and move everyone over individually. Thanks, Nick 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.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 CD851C2BA19 for ; Tue, 14 Apr 2020 11:35:18 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 7BB63206D5 for ; Tue, 14 Apr 2020 11:35:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VRrPqiVD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7BB63206D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 491k1b6FdqzDqbr for ; Tue, 14 Apr 2020 21:35:15 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::641; helo=mail-pl1-x641.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=VRrPqiVD; dkim-atps=neutral Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 491jzV5YDRzDqZp for ; Tue, 14 Apr 2020 21:33:26 +1000 (AEST) Received: by mail-pl1-x641.google.com with SMTP id d24so4541975pll.8 for ; Tue, 14 Apr 2020 04:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=KZ+sHNUWTGOOngDZlWZuibRHv6pBV5xa/Uz2LHhglIw=; b=VRrPqiVD/QCxdjEBbskkY+yCiShEK6wsEIXtHjLXfpvij1ltRLBYW8NzIJJmPGw7Jl 7O9rXprSSg2KypN2/n22gPbfrV2ko9yTd5ZQA5X2LQDSyGFUWQu8QBnphH70gUe+/FRK 5/ysYWz68GwkQi8JYoDLAb1lhU/6pBp5yLlGMV7SiRr2jMJHGt/nW+uAjgiUYV7ycto8 eFxubCIicj7SXfgr/8LiQbyXdkpfNE6H1TDEa73cP7OLaDzRMX9MMI1VYP3Q3GlNdo69 gNWUpXzn33RucYnWizv9TVCwAa7EJYfdk5B6bGls6Fic9fwDW2teTKTU4yxceD2TRnfL dySQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=KZ+sHNUWTGOOngDZlWZuibRHv6pBV5xa/Uz2LHhglIw=; b=WWpS9jAYdD0wHdZL/M2qXCntul5erK+BoEilf+KikeOHjZ5qtyAhI3nCp1eIJtVjR6 nXHkLXXiyeqUwNL7zGY8L4XcTZ+ybJQiqhZBwCxU5J8Vn2em2c5gARDuHT2lYFQ2xCOR VwGElUZzMsomU9YgYqn8uKgM0VPLikylyNFkpMWmOC3v1hhnxFpVJMVQ57AKshjoNHqf f/4OWtlREJ59XJEGkcIs5Ug2JXEG/DEgaxx5j++SPCUW76nX2hIV2PcRV7MohW8YVwiq bSiduaCIYAZNUWxM4856jikNdNIBYFtGd0DT2/9L4IcOVzBLOAttIOXXgPmxXy3CdHEU I00A== X-Gm-Message-State: AGi0PubjiioyG2b/7Z1llNoX6S56Fp4S8mSltvGvF06RAn+s7okzA/q/ 1T4tDvzhOR+t/k1l1r6FI8c= X-Google-Smtp-Source: APiQypIcyr6/I0Kkbv3wlFcU4/Xr/0wS9p1hSr/PXKwlPWpCeFL0ysIODdUC3n5T/abK9CdK/6LdFA== X-Received: by 2002:a17:902:6a88:: with SMTP id n8mr21744267plk.292.1586864004572; Tue, 14 Apr 2020 04:33:24 -0700 (PDT) Received: from localhost ([203.18.28.220]) by smtp.gmail.com with ESMTPSA id w2sm11023334pff.195.2020.04.14.04.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 04:33:23 -0700 (PDT) Date: Tue, 14 Apr 2020 21:31:49 +1000 From: Nicholas Piggin Subject: Re: [PATCH v2 1/4] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings To: Matthew Wilcox References: <20200413125303.423864-1-npiggin@gmail.com> <20200413125303.423864-2-npiggin@gmail.com> <20200413133444.GM21484@bombadil.infradead.org> In-Reply-To: <20200413133444.GM21484@bombadil.infradead.org> MIME-Version: 1.0 Message-Id: <1586863573.ufpx8o7f0i.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Will Deacon , Catalin Marinas , x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Excerpts from Matthew Wilcox's message of April 13, 2020 11:34 pm: > On Mon, Apr 13, 2020 at 10:53:00PM +1000, Nicholas Piggin wrote: >> vmalloc_to_page returns NULL for addresses mapped by larger pages[*]. >> Whether or not a vmap is huge depends on the architecture details, >> alignments, boot options, etc., which the caller can not be expected >> to know. Therefore HUGE_VMAP is a regression for vmalloc_to_page. >>=20 >> This change teaches vmalloc_to_page about larger pages, and returns >> the struct page that corresponds to the offset within the large page. >> This makes the API agnostic to mapping implementation details. >=20 > I'm trying to get us away from returning tail pages from various > functions. How much of a pain would it be to return the head page > instead of the tail page? Well, this is a fix for the interface for HUGE_VMAP stuff so it doesn't really make sense to change the implementation here. If you want to change or make a different API that would be a later patch, no? > Obviously the implementation gets simpler, > but can the callers cope? I've been focusing on the page cache, so I > haven't been looking at the vmalloc side of things at all. Well callers that operate on ioremap today (and vmalloc tomorrow) won't cope, because they're expecting a base page. If you wanted to change it I suspect the way to go would be introduce a new function and move everyone over individually. Thanks, Nick 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.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 473BCC2BA19 for ; Tue, 14 Apr 2020 11:33:30 +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 0B2072072D for ; Tue, 14 Apr 2020 11:33:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bo6+LDid"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VRrPqiVD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B2072072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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:Message-Id:MIME-Version:In-Reply-To: References:To:Subject:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vjXpUXjRv2qm0PvIQx9KqGigX7Uwb2wYMKHfiOO+3Ic=; b=bo6+LDidnWotBm IkaTYp3wAECygl/W13GquFW3mLHbGBx5mDDO4/sbxmAX5zch/wCZzi8+EDi+6OWJZd4c4m8bDcMob xqF3d7jGnMeMXxojjNh5j+48gfI9FR6ErEGrLhPjd+FTgsq5xzbt4skXLJINU7b6EdhYrKELKQAiA 5HLbd0QLTJj45AVlYBRTYiVLVmsXdhruBtoeXC2RPnHPYtaUMsNHWY7rk8lmh5OkcSuNkH8eSs4rA adGFNAr+24QH+z5s+wcqDYzpbJu/jNzX5eDjiaM76d+u5S2f6QMifvUQZNq69Vm8sUGx7WFDW4/y5 ZGoiYkF3sFOkocyXDh3w==; 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 1jOJom-0002P0-Gh; Tue, 14 Apr 2020 11:33:28 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOJoj-0002O5-JY for linux-arm-kernel@lists.infradead.org; Tue, 14 Apr 2020 11:33:26 +0000 Received: by mail-pj1-x1041.google.com with SMTP id t40so5077406pjb.3 for ; Tue, 14 Apr 2020 04:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=KZ+sHNUWTGOOngDZlWZuibRHv6pBV5xa/Uz2LHhglIw=; b=VRrPqiVD/QCxdjEBbskkY+yCiShEK6wsEIXtHjLXfpvij1ltRLBYW8NzIJJmPGw7Jl 7O9rXprSSg2KypN2/n22gPbfrV2ko9yTd5ZQA5X2LQDSyGFUWQu8QBnphH70gUe+/FRK 5/ysYWz68GwkQi8JYoDLAb1lhU/6pBp5yLlGMV7SiRr2jMJHGt/nW+uAjgiUYV7ycto8 eFxubCIicj7SXfgr/8LiQbyXdkpfNE6H1TDEa73cP7OLaDzRMX9MMI1VYP3Q3GlNdo69 gNWUpXzn33RucYnWizv9TVCwAa7EJYfdk5B6bGls6Fic9fwDW2teTKTU4yxceD2TRnfL dySQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=KZ+sHNUWTGOOngDZlWZuibRHv6pBV5xa/Uz2LHhglIw=; b=IAHHOWaSwThPwttQnzU+chys7XjVsrsN6Gg8qm6mKMcI5L0h1n7Vsr/y57RFvR3nfX 3Omk+y7uv9GWPqgUhBjbrU8sHLyPu6dmthNhFjuGsCsF3+IdbcJ03LHXtTCojeIWCI+s CzGd6ZRN83ZRE2gibKKR4FtrDOVZa9seHgWslOKzb1qKGSkPX8aH5myet0l5B3PdVfjp zm2xZiLKpUQKfcMmqbYIHe9zWaSC7+eLIMIZRA1xs2uia1NEu+21XrtydvykZ3HjGyN7 up7zeghA4qI2318a5rh+1sPwViZmhE7Gt67ecze9LHcl7KQ9XYfjRFM+Uw8AZ5R2ZyyW RBoQ== X-Gm-Message-State: AGi0PubqsNlQ5EntE7khynlrAAC02mF/yVxnSQGoP8talpQJ/2g5azcA NrlJEq9j1XPc+0eSvD+T6Xc= X-Google-Smtp-Source: APiQypIcyr6/I0Kkbv3wlFcU4/Xr/0wS9p1hSr/PXKwlPWpCeFL0ysIODdUC3n5T/abK9CdK/6LdFA== X-Received: by 2002:a17:902:6a88:: with SMTP id n8mr21744267plk.292.1586864004572; Tue, 14 Apr 2020 04:33:24 -0700 (PDT) Received: from localhost ([203.18.28.220]) by smtp.gmail.com with ESMTPSA id w2sm11023334pff.195.2020.04.14.04.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 04:33:23 -0700 (PDT) Date: Tue, 14 Apr 2020 21:31:49 +1000 From: Nicholas Piggin Subject: Re: [PATCH v2 1/4] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings To: Matthew Wilcox References: <20200413125303.423864-1-npiggin@gmail.com> <20200413125303.423864-2-npiggin@gmail.com> <20200413133444.GM21484@bombadil.infradead.org> In-Reply-To: <20200413133444.GM21484@bombadil.infradead.org> MIME-Version: 1.0 Message-Id: <1586863573.ufpx8o7f0i.astroid@bobo.none> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200414_043325_643551_1C168799 X-CRM114-Status: GOOD ( 14.36 ) 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-arch@vger.kernel.org, Will Deacon , Catalin Marinas , x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org 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 Excerpts from Matthew Wilcox's message of April 13, 2020 11:34 pm: > On Mon, Apr 13, 2020 at 10:53:00PM +1000, Nicholas Piggin wrote: >> vmalloc_to_page returns NULL for addresses mapped by larger pages[*]. >> Whether or not a vmap is huge depends on the architecture details, >> alignments, boot options, etc., which the caller can not be expected >> to know. Therefore HUGE_VMAP is a regression for vmalloc_to_page. >> >> This change teaches vmalloc_to_page about larger pages, and returns >> the struct page that corresponds to the offset within the large page. >> This makes the API agnostic to mapping implementation details. > > I'm trying to get us away from returning tail pages from various > functions. How much of a pain would it be to return the head page > instead of the tail page? Well, this is a fix for the interface for HUGE_VMAP stuff so it doesn't really make sense to change the implementation here. If you want to change or make a different API that would be a later patch, no? > Obviously the implementation gets simpler, > but can the callers cope? I've been focusing on the page cache, so I > haven't been looking at the vmalloc side of things at all. Well callers that operate on ioremap today (and vmalloc tomorrow) won't cope, because they're expecting a base page. If you wanted to change it I suspect the way to go would be introduce a new function and move everyone over individually. Thanks, Nick _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel