Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp358083pxb; Wed, 14 Apr 2021 17:44:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBwFi4nslod5240Gcer+xaY+P80fe242C/NIIRmM6or0IqvTkkcIdZTMKgXqJtDME398g1 X-Received: by 2002:a17:90b:4718:: with SMTP id jc24mr923536pjb.210.1618447493947; Wed, 14 Apr 2021 17:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618447493; cv=none; d=google.com; s=arc-20160816; b=PG3wvUB94v2jnRAfBChpRiOLxBFx6enlsgKn2Ez+RFIzyZZauHpRF3AjNt268t3ipt yRpWTngR6ifSBHTjxgfsHUBLDw6mCwFohrwCZZmDqgHDdd2fJh/Y34t0vZUwc3Sq7bQA DeORs/J8lVVBO6APfNhcHLdWW/icQPA9JOjivx/b47RhUYUGK61y8BuSEAlwFVvx/0z/ 6EX/in9RBJUThYBdJDOn1wDQBxEA8Bohn6d8PvawJ2Jk6PwwzcaTDoWTlahJPSHHO4lV 2Aj4EaAsTT2o+3k5voCiaB0bcElFK3yN4jIfXaaIX3ZGBXtBYxrDpWkqT44FGdNLPlF2 0TiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=yabYzh4cj6LIMrN9G97xSgLjHLEzr2USN5EFIehOUuc=; b=tnGtumiPSf3n/oUF4NCRJa+6TcJ5Rbur2qHzx3LrqeE/H8RV/+wm3djvR+8oLIo39u k3xxCXNnUdXnBt23IocEcQrQVyhbaaVK9qslQuwK37P5OWPvrBae+OKQAtF1Dk0YHlfr IIk7G8W3YwmjpU3p+EQ+J0jawKnbTKPp4Z2sSWL4RG7W9Ch9PyZ0KvTokxa7+16hS6Yq a7GptylVUyIBUj7Jkwo0X66KpvDvnznoyp3/ShnIRi0ne/AxmnzHL5s+dAT349XIeKLB Pyq74hTyqnInHe7/wiJBkar3jikg5jXMMM4OzmOs8p++8lSBzu21EhRmBydLnBERdbw9 VT8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XWu/W9zN"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b11si1356617plg.355.2021.04.14.17.44.42; Wed, 14 Apr 2021 17:44:53 -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=@redhat.com header.s=mimecast20190719 header.b="XWu/W9zN"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235007AbhDNTm0 (ORCPT + 99 others); Wed, 14 Apr 2021 15:42:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27758 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234993AbhDNTmY (ORCPT ); Wed, 14 Apr 2021 15:42:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618429322; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yabYzh4cj6LIMrN9G97xSgLjHLEzr2USN5EFIehOUuc=; b=XWu/W9zNsUch7eKaivqBiatkVfxuZ4Hj2o/JCfOYLI0qXiv1b69UqMb0zMgIBHX+rvmOy+ 1TfC7pqssKcjYI+9JEbZ5BYfUNGJ5Mo6q9fph0nDspfTDzcI2mdq9Zm8NGfkyZToE8Y3pv d4y1vCKO+0nhThxZQ9aAj7BebV6qzDw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-8tbCLW4hMAWToOB92QjbSw-1; Wed, 14 Apr 2021 15:42:00 -0400 X-MC-Unique: 8tbCLW4hMAWToOB92QjbSw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D495A1008060; Wed, 14 Apr 2021 19:41:54 +0000 (UTC) Received: from carbon (unknown [10.36.110.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21B355D6BA; Wed, 14 Apr 2021 19:41:33 +0000 (UTC) Date: Wed, 14 Apr 2021 21:41:32 +0200 From: Jesper Dangaard Brouer To: Ilias Apalodimas Cc: brouer@redhat.com, Shakeel Butt , Matthew Wilcox , 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: <20210414214132.74f721dd@carbon> In-Reply-To: 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-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 10 Apr 2021 21:27:31 +0300 Ilias Apalodimas wrote: > On Sat, Apr 10, 2021 at 10:42:30AM -0700, Shakeel Butt wrote: > > > On Sat, Apr 10, 2021 at 9:16 AM Ilias Apalodimas > > wrote: > > > > > > Hi Matthew > > > > > > On Sat, Apr 10, 2021 at 04:48:24PM +0100, Matthew Wilcox wrote: > > > > On Sat, Apr 10, 2021 at 12:37:58AM +0200, Matteo Croce wrote: > > > > > This is needed by the page_pool to avoid recycling a page not allocated > > > > > via page_pool. > > > > > > > > Is the PageType mechanism more appropriate to your needs? It wouldn't > > > > be if you use page->_mapcount (ie mapping it to userspace). > > > > > > Interesting! > > > Please keep in mind this was written ~2018 and was stale on my branches for > > > quite some time. So back then I did try to use PageType, but had not free > > > bits. Looking at it again though, it's cleaned up. So yes I think this can > > > be much much cleaner. Should we go and define a new PG_pagepool? > > > > > > > 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. I'm not sure we want or should "allow" page_pool be used for TCP RX zerocopy. For several reasons. (1) This implies mapping these pages page to userspace, which AFAIK means using page->mapping and page->index members (right?). (2) It feels wrong (security wise) to keep the DMA-mapping (for the device) and also map this page into userspace. (3) The page_pool is optimized for refcnt==1 case, and AFAIK TCP-RX zerocopy will bump the refcnt, which means the page_pool will not recycle the page when it see the elevated refcnt (it will instead release its DMA-mapping). (4) I remember vaguely that this code path for (TCP RX zerocopy) uses page->private for tricks. And our patch [3/5] use page->private for storing xdp_mem_info. IMHO when the SKB travel into this TCP RX zerocopy code path, we should call page_pool_release_page() to release its DMA-mapping. > > [1] https://lore.kernel.org/linux-mm/20210316013003.25271-1-arjunroy.kdev@gmail.com/ -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer