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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 AEC4CC43461 for ; Tue, 11 May 2021 14:26:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84C30611CC for ; Tue, 11 May 2021 14:26:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231776AbhEKO1W (ORCPT ); Tue, 11 May 2021 10:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231745AbhEKO1T (ORCPT ); Tue, 11 May 2021 10:27:19 -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 42EC8C06175F for ; Tue, 11 May 2021 07:26:13 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id y2so26499508ybq.13 for ; Tue, 11 May 2021 07:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CEaJC4cb5Y4A+8IsZZEeBM2QdsYN5Y7DFCllFllvi+8=; b=zHX1LMvKjHtyR4sV+y0aqvfoFcsp0EjIHx5Pt5zG+iVHvcxKYTo3vrUGTaAWwd8n54 Sfqn8OV7GElBxhfBXlUssjujJWtAC4qSGRQRUdjhpxxfIF/QhMZuc4qpQhRqMR2wxO35 PUJFZ124qF2EtUdMTmUBpVLFUQUtq2V0+5HEOB02MRwMRFtF2H0ypRhbY9hAsMcY5VaX NMWRowJcerYr/hEpfCDq56QNJVhvrpZzyFRgGaLU7Od2GT34GNf6kMsyWrhX+phrvlrk he7jEFsGAUZVNd7E0mAorNTJN4vbw3juF/pR8H2tEAQ/4MVq5x3yPsBcSeKS4v/uiUHB uX1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CEaJC4cb5Y4A+8IsZZEeBM2QdsYN5Y7DFCllFllvi+8=; b=mU5i5nAGFZVX+kOkt0yWu0dPOU62abc+uaFGUHvjQUKzO0cn+9tSfj1KrzY/3CJQyo 7aciEVr/I0PPfeaWKx7y8N1VE5ZSIjVB/JOnZmF7dgMnaGfpTmEHOG/BRZmELcb/Wt/4 xWXjNvtgsZ3g7bU7Rr1Dp0oh8Rc8/BDHkp593htpKqoC+GxpaoTS7Otf/anZCkTa0qmU qn59/cLQYqL1xu96oHsBRIf2YnJt23DDpK4DbVHmw4tdU3scnq6vyTZaVe+1dJhKndao HDdei5m8drgfBvj8tsa180mkTYFhksvVuswBTtAh145fzq9V4Y4NQWHnFPymc7w0v+hW LXdQ== X-Gm-Message-State: AOAM531G+dQl3AwcT51qfjCS5uFKEqM75PYKhMnXXzq2YhmLhADRiVNh OwFcCDpBk7k39hrcXKCQhEB3KqLcDxSXArg+Bfg8kQ== X-Google-Smtp-Source: ABdhPJzh4VjKqBeHWbxCHf0TChJFitLGXDaA/GUpbzyFXfVL/53v7XHycwNEzDPWQyzljYzsrL3I6khv5C0KKCJRTSQ= X-Received: by 2002:a25:d0cb:: with SMTP id h194mr28426645ybg.408.1620743172546; Tue, 11 May 2021 07:26:12 -0700 (PDT) MIME-Version: 1.0 References: <20210511133118.15012-1-mcroce@linux.microsoft.com> <20210511133118.15012-2-mcroce@linux.microsoft.com> In-Reply-To: From: Ilias Apalodimas Date: Tue, 11 May 2021 17:25:36 +0300 Message-ID: Subject: Re: [PATCH net-next v4 1/4] mm: add a signature in struct page To: Matthew Wilcox Cc: Matteo Croce , Networking , Linux-MM , Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari , "David S. Miller" , Jakub Kicinski , Thomas Petazzoni , Marcin Wojtas , Russell King , Mirko Lindner , Stephen Hemminger , Tariq Toukan , Jesper Dangaard Brouer , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Boris Pismenny , Arnd Bergmann , Andrew Morton , "Peter Zijlstra (Intel)" , Vlastimil Babka , Yu Zhao , Will Deacon , Michel Lespinasse , Fenghua Yu , Roman Gushchin , Hugh Dickins , Peter Xu , Jason Gunthorpe , Jonathan Lemon , Alexander Lobakin , Cong Wang , wenxu , Kevin Hao , Jakub Sitnicki , Marco Elver , Willem de Bruijn , Miaohe Lin , Yunsheng Lin , Guillaume Nault , open list , linux-rdma@vger.kernel.org, bpf , Eric Dumazet , David Ahern , Lorenzo Bianconi , Saeed Mahameed , Andrew Lunn , Paolo Abeni , Sven Auhagen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Tue, 11 May 2021 at 17:19, Matthew Wilcox wrote: > > On Tue, May 11, 2021 at 05:11:13PM +0300, Ilias Apalodimas wrote: > > Hi Matthew, > > > > On Tue, May 11, 2021 at 02:45:32PM +0100, Matthew Wilcox wrote: > > > On Tue, May 11, 2021 at 03:31:15PM +0200, Matteo Croce wrote: > > > > @@ -101,6 +101,7 @@ struct page { > > > > * 32-bit architectures. > > > > */ > > > > unsigned long dma_addr[2]; > > > > + unsigned long signature; > > > > }; > > > > struct { /* slab, slob and slub */ > > > > union { > > > > > > No. Signature now aliases with page->mapping, which is going to go > > > badly wrong for drivers which map this page into userspace. > > > > > > I had this as: > > > > > > + unsigned long pp_magic; > > > + unsigned long xmi; > > > + unsigned long _pp_mapping_pad; > > > unsigned long dma_addr[2]; > > > > > > and pp_magic needs to be set to something with bits 0&1 clear and > > > clearly isn't a pointer. I went with POISON_POINTER_DELTA + 0x40. > > > > Regardless to the changes required, there's another thing we'd like your > > opinion on. > > There was a change wrt to the previous patchset. We used to store the > > struct xdp_mem_info into page->private. On the new version we store the > > page_pool ptr address in page->private (there's an explanation why on the > > mail thread, but the tl;dr is that we can get some more speed and keeping > > xdp_mem_info is not that crucial). So since we can just store the page_pool > > address directly, should we keep using page->private or it's better to > > do: > > > > + unsigned long pp_magic; > > + unsigned long pp_ptr; > > + unsigned long _pp_mapping_pad; > > unsigned long dma_addr[2]; > > and use pp_ptr? > > I'd rather you didn't use page_private ... Any reason not to use: > > unsigned long pp_magic; > struct page_pool *pp; > unsigned long _pp_mapping_pad; > unsigned long dma_addr[2]; > > ? Nope not at all, either would work. we'll switch to that 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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 670A8C43460 for ; Tue, 11 May 2021 14:26:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E2EA461376 for ; Tue, 11 May 2021 14:26:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2EA461376 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4559A6B0072; Tue, 11 May 2021 10:26:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3DBE66B0073; Tue, 11 May 2021 10:26:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2091D6B0074; Tue, 11 May 2021 10:26:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id 01A2F6B0072 for ; Tue, 11 May 2021 10:26:13 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id ACFE35831 for ; Tue, 11 May 2021 14:26:13 +0000 (UTC) X-FDA: 78129175026.21.D26BB6B Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf05.hostedemail.com (Postfix) with ESMTP id 419A0E00058F for ; Tue, 11 May 2021 14:26:07 +0000 (UTC) Received: by mail-yb1-f177.google.com with SMTP id m9so26588827ybm.3 for ; Tue, 11 May 2021 07:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CEaJC4cb5Y4A+8IsZZEeBM2QdsYN5Y7DFCllFllvi+8=; b=zHX1LMvKjHtyR4sV+y0aqvfoFcsp0EjIHx5Pt5zG+iVHvcxKYTo3vrUGTaAWwd8n54 Sfqn8OV7GElBxhfBXlUssjujJWtAC4qSGRQRUdjhpxxfIF/QhMZuc4qpQhRqMR2wxO35 PUJFZ124qF2EtUdMTmUBpVLFUQUtq2V0+5HEOB02MRwMRFtF2H0ypRhbY9hAsMcY5VaX NMWRowJcerYr/hEpfCDq56QNJVhvrpZzyFRgGaLU7Od2GT34GNf6kMsyWrhX+phrvlrk he7jEFsGAUZVNd7E0mAorNTJN4vbw3juF/pR8H2tEAQ/4MVq5x3yPsBcSeKS4v/uiUHB uX1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CEaJC4cb5Y4A+8IsZZEeBM2QdsYN5Y7DFCllFllvi+8=; b=MjwEhYPoRpQ9lKJcc4IFeDYR8d+1AWjMzzZDzLO1ZP5hPGZje8VEIvJrn2wKtGwMoA AfQzpY1lEhOdNihKS97wPZRo9mDaKJH2yjfcDZns+fGmiGDf8lAoyCLMnXtRVM8SrE86 AXG3JfcK1ujd19iYbjzMrNvBOve7JsAwDU83fhT5OaXc2AK79SridkYHVDT0Wa4vaw49 XWBB1z/q1i33/ImUAXzGts2hLsSLkMGZwr4+aDekSe3d8W2IenxUfI/XOpM6uwjVuejW I4rTh3cspLaUT4r/1/DKgGC2mBHTs8UJ1cD0yzdNT2omJN5mE2NtDmH3Z/ZqhsWMuOB7 r6rA== X-Gm-Message-State: AOAM530FYTrkKKMfHMewqiOXZdVUw2I+LsadYYLGgIvjzHvLy+G2CwYD jORXAgSwgAfXLZd7MJLFXwIe280Mb4ABXkUrbwQcwA== X-Google-Smtp-Source: ABdhPJzh4VjKqBeHWbxCHf0TChJFitLGXDaA/GUpbzyFXfVL/53v7XHycwNEzDPWQyzljYzsrL3I6khv5C0KKCJRTSQ= X-Received: by 2002:a25:d0cb:: with SMTP id h194mr28426645ybg.408.1620743172546; Tue, 11 May 2021 07:26:12 -0700 (PDT) MIME-Version: 1.0 References: <20210511133118.15012-1-mcroce@linux.microsoft.com> <20210511133118.15012-2-mcroce@linux.microsoft.com> In-Reply-To: From: Ilias Apalodimas Date: Tue, 11 May 2021 17:25:36 +0300 Message-ID: Subject: Re: [PATCH net-next v4 1/4] mm: add a signature in struct page To: Matthew Wilcox Cc: Matteo Croce , Networking , Linux-MM , Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari , "David S. Miller" , Jakub Kicinski , Thomas Petazzoni , Marcin Wojtas , Russell King , Mirko Lindner , Stephen Hemminger , Tariq Toukan , Jesper Dangaard Brouer , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Boris Pismenny , Arnd Bergmann , Andrew Morton , "Peter Zijlstra (Intel)" , Vlastimil Babka , Yu Zhao , Will Deacon , Michel Lespinasse , Fenghua Yu , Roman Gushchin , Hugh Dickins , Peter Xu , Jason Gunthorpe , Jonathan Lemon , Alexander Lobakin , Cong Wang , wenxu , Kevin Hao , Jakub Sitnicki , Marco Elver , Willem de Bruijn , Miaohe Lin , Yunsheng Lin , Guillaume Nault , open list , linux-rdma@vger.kernel.org, bpf , Eric Dumazet , David Ahern , Lorenzo Bianconi , Saeed Mahameed , Andrew Lunn , Paolo Abeni , Sven Auhagen Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=zHX1LMvK; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf05.hostedemail.com: domain of ilias.apalodimas@linaro.org designates 209.85.219.177 as permitted sender) smtp.mailfrom=ilias.apalodimas@linaro.org X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 419A0E00058F X-Stat-Signature: wdsadnyx6nts1o9yeqdt1kfxnwoepb69 Received-SPF: none (linaro.org>: No applicable sender policy available) receiver=imf05; identity=mailfrom; envelope-from=""; helo=mail-yb1-f177.google.com; client-ip=209.85.219.177 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620743167-16570 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: On Tue, 11 May 2021 at 17:19, Matthew Wilcox wrote: > > On Tue, May 11, 2021 at 05:11:13PM +0300, Ilias Apalodimas wrote: > > Hi Matthew, > > > > On Tue, May 11, 2021 at 02:45:32PM +0100, Matthew Wilcox wrote: > > > On Tue, May 11, 2021 at 03:31:15PM +0200, Matteo Croce wrote: > > > > @@ -101,6 +101,7 @@ struct page { > > > > * 32-bit architectures. > > > > */ > > > > unsigned long dma_addr[2]; > > > > + unsigned long signature; > > > > }; > > > > struct { /* slab, slob and slub */ > > > > union { > > > > > > No. Signature now aliases with page->mapping, which is going to go > > > badly wrong for drivers which map this page into userspace. > > > > > > I had this as: > > > > > > + unsigned long pp_magic; > > > + unsigned long xmi; > > > + unsigned long _pp_mapping_pad; > > > unsigned long dma_addr[2]; > > > > > > and pp_magic needs to be set to something with bits 0&1 clear and > > > clearly isn't a pointer. I went with POISON_POINTER_DELTA + 0x40. > > > > Regardless to the changes required, there's another thing we'd like your > > opinion on. > > There was a change wrt to the previous patchset. We used to store the > > struct xdp_mem_info into page->private. On the new version we store the > > page_pool ptr address in page->private (there's an explanation why on the > > mail thread, but the tl;dr is that we can get some more speed and keeping > > xdp_mem_info is not that crucial). So since we can just store the page_pool > > address directly, should we keep using page->private or it's better to > > do: > > > > + unsigned long pp_magic; > > + unsigned long pp_ptr; > > + unsigned long _pp_mapping_pad; > > unsigned long dma_addr[2]; > > and use pp_ptr? > > I'd rather you didn't use page_private ... Any reason not to use: > > unsigned long pp_magic; > struct page_pool *pp; > unsigned long _pp_mapping_pad; > unsigned long dma_addr[2]; > > ? Nope not at all, either would work. we'll switch to that