Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp599171pxb; Sat, 10 Apr 2021 12:43:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzE/rjE9kU81II6wnfCak0kdDn9NReZQzjhKXjDDsiMVHHK/iY67zDTwWyOnoGwIZWgpWVr X-Received: by 2002:a17:906:37da:: with SMTP id o26mr1656165ejc.413.1618083797065; Sat, 10 Apr 2021 12:43:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618083797; cv=none; d=google.com; s=arc-20160816; b=yX3VFaK8Ab6xIGl6QPfqVrIQIueUdmXmUtvqY2VxzAGo1Pia2J9v3bNA+9ECb6IizQ M72O2yaN/Vs7pV6x6BYpuTsCy67/abiyBNRzGjYYvu1wEVuGrNo3AOAab7z2hdv7+fwk OeUwrUZoJJwKjTHrII7CacCqe1iriQ5wpSTPIMNee1hjrZfneJRB9JRhmSxnGwzX4YPQ kXotRXCV2jRlJOgLRREOjQORtxB8h9SQsCsEApp0nlrvyDmNH0Fk+4mToNYEkKKhgG6/ dHoRS4K1ZepP+3bXELXvBhnv+/I6k5Q7KQ+ooeUNRg4O51lXaRpvcC3OXG6yIx36e3db aREQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=99tw4rU1bA7MagbzMJxSzuFi8jXoglqEVx3rS3aCE60=; b=QNuWOi4YOeGQL1vgbuI6JpW1Ztejk+G6UZik5qVyGKRcPSXugS2uxh9/PWZithfvpC FYK6Mul1T0MSbq/Bzpwx8TWiN60I9EsBNSt1+sBB3jlVDMk6ZCl1g0qL/h5qYCz4CCXA miX+AtvGODB+tNOr5pfZaxpVZoUVXy/7NhSykkOvt+/XXlxqSbUXHHEU2nyCt3PqmxdP cHBp+lIUvEtfxX2z3p3v49nXVIWi4hmD4h0S1cv06po//cGPZvcoe5hxCxigOuRVO0Yi bJTMW8MSB5NgRmeRyxwgQ7mt6HMhARULQluzYLc07RBrZ8wV1aLlmTEhFdVcuT+7oAvk SNYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=UGDCSJOi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dy5si4163050edb.186.2021.04.10.12.42.41; Sat, 10 Apr 2021 12:43:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=UGDCSJOi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234950AbhDJTkn (ORCPT + 99 others); Sat, 10 Apr 2021 15:40:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234439AbhDJTkm (ORCPT ); Sat, 10 Apr 2021 15:40:42 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFDF1C06138A; Sat, 10 Apr 2021 12:40:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=99tw4rU1bA7MagbzMJxSzuFi8jXoglqEVx3rS3aCE60=; b=UGDCSJOiJywTxRKlV+QWUUkYP7 kHAPe+brHhCRWvTl8X0RQzmmsptTNBASWc4j9OilorC2V0moXMOenrd66GalMZDuksOyQBFG7sFY1 1jLeCodMt4E0psSQ7+VC0cCIB4Xzgu2R8jxbO4PUlnN76xoO30oeD5CgPk5fzBEQzyihDvOiN26Lo 12Pdio68QTCIU89I+zOINcuLobkzYiXQTdLKdO5+/R9uyi2j0Xk93sPyWtmnr6bYL3LR3yx7oY7/H d9DYi1uymvbbmI2fSLCtHv4aPx2dEN7oqaKQBU/Sg9s6Z+Az2JgzxmDEIeClT51aqbma6dXWGBGn5 RICJ642g==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lVJSV-0023YN-DW; Sat, 10 Apr 2021 19:40:02 +0000 Date: Sat, 10 Apr 2021 20:39:55 +0100 From: Matthew Wilcox To: Ilias Apalodimas Cc: Shakeel Butt , Matteo Croce , netdev , 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 , Guoqing Jiang , Jonathan Lemon , Alexander Lobakin , Cong Wang , wenxu , Kevin Hao , Aleksandr Nogikh , Jakub Sitnicki , Marco Elver , Willem de Bruijn , Miaohe Lin , Yunsheng Lin , Guillaume Nault , LKML , linux-rdma@vger.kernel.org, bpf , Eric Dumazet , David Ahern , Lorenzo Bianconi , Saeed Mahameed , Andrew Lunn , Paolo Abeni Subject: Re: [PATCH net-next v3 2/5] mm: add a signature in struct page Message-ID: <20210410193955.GA2531743@casper.infradead.org> References: <20210409223801.104657-1-mcroce@linux.microsoft.com> <20210409223801.104657-3-mcroce@linux.microsoft.com> <20210410154824.GZ2531743@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 10, 2021 at 09:27:31PM +0300, Ilias Apalodimas wrote: > > Can this page_pool be used for TCP RX zerocopy? If yes then PageType > > can not be used. > > Yes it can, since it's going to be used as your default allocator for > payloads, which might end up on an SKB. > So we have to keep the extra added field on struct page for our mark. > Matthew had an intersting idea. He suggested keeping it, but changing the > magic number, so it can't be a kernel address, but I'll let him follow > up on the details. Sure! So, given the misalignment problem I discovered yesterday [1], we probably want a page_pool page to look like: unsigned long flags; unsigned long pp_magic; unsigned long xmi; unsigned long _pp_mapping_pad; dma_addr_t dma_addr; /* might be one or two words */ The only real restriction here is that pp_magic should not be a valid pointer, and it must have the bottom bit clear. I'd recommend something like: #define PP_MAGIC (0x20 + POISON_POINTER_DELTA) This leaves page->mapping as NULL, so you don't have to worry about clearing it before free. [1] https://lore.kernel.org/linux-mm/20210410024313.GX2531743@casper.infradead.org/