Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1708470pxf; Fri, 9 Apr 2021 15:39:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpytAc1lIaU/T9pIGs/Kp5+KWFjuY40ftXZTmiDop0adgaj7dHkjw+4v70ybLGSuvne4sC X-Received: by 2002:a17:90b:1d87:: with SMTP id pf7mr15938546pjb.208.1618007997589; Fri, 09 Apr 2021 15:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618007997; cv=none; d=google.com; s=arc-20160816; b=aBn/+qKn76GJNc3B2Hwr0LGayi2L+65Fn77kyccwVyPqMtD6L0kztAkURoT/V16hQU gfBLVtEIsC+WhlEcitTlNCvYWwYRIDbi3xp6gHf2kbKALY5/TsWvr79LjCpRqpse0koJ hHrZr69xQ97Wn5CAHC424fS4ONd+o7KuwYGkAXDlP1emqQLDHuzVYtlwKpD0lqy4BZtZ wsh4Euzfp6JjhFE0EH4ouAxd69y4imvEcRuLkykySLRSxJCmm70c4oaWsHC3xGcdZSSl gOEwTSceknO2l9jGnpYGkTomR1gX3GncZt8daHneL1xS8zL2NgXZq0n7/IP0cz3BMa0S cZ7w== 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:date:subject:cc:to:from; bh=vTaN//8xhOW6+dxdPY1I1bInoY8eqI/bBr1slqBlUSQ=; b=AOW4XIVAzk1AwHnvVgeZRak6EA4QCRYernagEshhPY8nnuaxVzGiwA/Vfji025OF8P iOHHLZbohExvPh4e07AdZw/9/59+QUYqx6+z52SybA+7MFAgUDLWyg7vSj7zst3uKO+x RCcfG1CSzrPdcIlT93UcnnD9Xsdnh/pdHHufvmCJgpr1cUxxwuftglnMyMWXT2PQ1kOi n44faBJKF5WpFg2kd6sA11c+7o+mpv9Vv8M9Rfn6tgnm51lZwWQrGrPY1juLk7vAFQjE tA3l5yZhg7uzRFTbNZUl4YXU32wlW8Iv8L3xjyY1RlDjTPGD6cr9nPP+k283uJBIQYBI I3Pg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 3si3333705pfh.268.2021.04.09.15.39.44; Fri, 09 Apr 2021 15:39:57 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235094AbhDIWiw (ORCPT + 99 others); Fri, 9 Apr 2021 18:38:52 -0400 Received: from mail-ej1-f54.google.com ([209.85.218.54]:41907 "EHLO mail-ej1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234602AbhDIWiu (ORCPT ); Fri, 9 Apr 2021 18:38:50 -0400 Received: by mail-ej1-f54.google.com with SMTP id g17so8223581ejp.8; Fri, 09 Apr 2021 15:38:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vTaN//8xhOW6+dxdPY1I1bInoY8eqI/bBr1slqBlUSQ=; b=MDJPl/myf2AZgAwuJjMBhWk6pfLHyNCg5mhMjK7qfm2mLiXx/A9XoQhXloOOf4LGkn 53vW/FmHMwWPCBwPI3wheZ5VDKq2BFNWEdh5rSaSv9gtJdxPZRg8W5r5B/4zuSVash/A PJRBHjkQRG/XjQn2X3x45djtx++ZYgObD0W6X+Pop7E2M/jDmkq1pvzMcgcfqnQ43jh+ Ttg2wFetjLyIWIpm3ZONTyLR4V0X6mQL7T7BV0R0wNBZ5rVcNrgEedl553XuaUDQVuC+ kvkmtUkvWO/90MTteiSdOn6sju+C5f+viLBtzl2USOaS+Z2qDjiPkuvi852X2Kp8d+6f s0jA== X-Gm-Message-State: AOAM532Bu3ACDFh50oZWReuhk5OfYcyiOMFAft6X60gR0OVvA+taK4UF G0M6wDdxoT/hnwfwnhJEZFTSLo24GX8PiA== X-Received: by 2002:a17:907:3c08:: with SMTP id gh8mr4361500ejc.439.1618007916135; Fri, 09 Apr 2021 15:38:36 -0700 (PDT) Received: from msft-t490s.teknoraver.net (net-93-66-21-119.cust.vodafonedsl.it. [93.66.21.119]) by smtp.gmail.com with ESMTPSA id s20sm2108726edu.93.2021.04.09.15.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 15:38:35 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org, linux-mm@kvack.org Cc: 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 , Ilias Apalodimas , 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 , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, bpf@vger.kernel.org, Matthew Wilcox , Eric Dumazet , David Ahern , Lorenzo Bianconi , Saeed Mahameed , Andrew Lunn , Paolo Abeni Subject: [PATCH net-next v3 2/5] mm: add a signature in struct page Date: Sat, 10 Apr 2021 00:37:58 +0200 Message-Id: <20210409223801.104657-3-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210409223801.104657-1-mcroce@linux.microsoft.com> References: <20210409223801.104657-1-mcroce@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matteo Croce This is needed by the page_pool to avoid recycling a page not allocated via page_pool. Signed-off-by: Matteo Croce --- include/linux/mm_types.h | 1 + include/net/page_pool.h | 2 ++ net/core/page_pool.c | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 6613b26a8894..ef2d0d5f62e4 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -101,6 +101,7 @@ struct page { * 32-bit architectures. */ dma_addr_t dma_addr; + unsigned long signature; }; struct { /* slab, slob and slub */ union { diff --git a/include/net/page_pool.h b/include/net/page_pool.h index b5b195305346..b30405e84b5e 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -63,6 +63,8 @@ */ #define PP_ALLOC_CACHE_SIZE 128 #define PP_ALLOC_CACHE_REFILL 64 +#define PP_SIGNATURE 0x20210303 + struct pp_alloc_cache { u32 count; void *cache[PP_ALLOC_CACHE_SIZE]; diff --git a/net/core/page_pool.c b/net/core/page_pool.c index ad8b0707af04..2ae9b554ef98 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -232,6 +232,8 @@ static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool, page_pool_dma_sync_for_device(pool, page, pool->p.max_len); skip_dma_map: + page->signature = PP_SIGNATURE; + /* Track how many pages are held 'in-flight' */ pool->pages_state_hold_cnt++; @@ -302,6 +304,8 @@ void page_pool_release_page(struct page_pool *pool, struct page *page) DMA_ATTR_SKIP_CPU_SYNC); page->dma_addr = 0; skip_dma_unmap: + page->signature = 0; + /* This may be the last page returned, releasing the pool, so * it is not safe to reference pool afterwards. */ -- 2.30.2