Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4755305pxj; Wed, 12 May 2021 12:29:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRIKFZcIwHbw+dC1oZzq6DDiMwQ4wVxWCm9U9cv7xeu5qWvaEtPWnwQn/yxL1lqjI94O/H X-Received: by 2002:a17:906:f894:: with SMTP id lg20mr2160300ejb.355.1620847798437; Wed, 12 May 2021 12:29:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620847798; cv=none; d=google.com; s=arc-20160816; b=uXymJV5IliufLQPl+ShyGeOdlK0uyWzdWSLldvyHAoK2rttnOYedGtvaDHBx8urSNN TjjXnoveLgWE/ZCE9OlnVIgwwuxhxcvkK5S8lwZQKi96i8X0aQzhoZuzTuW6JmBErMr7 ma0DZbvJvypUN63mSfpopdWopNIXp7FyL7Uy2t1gRVFwxi3fs1UYRW3jZoJbGR9pk8bH fjyOADlWEVfSwnhoXbY6ph/70VUG8Q1e4g/wJl6OB5BK6V47ZxgxdwaEhxlpr7hjBXKq KeG1e8U46iddtPRekuJYcsZNcnJKsDpXL0+cHS5kFe9XyJVf5zxPdq8TH61Z7mF7Qm72 rSJg== 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=bDKYc6juyaymxPVjFoz4H55W1iGwXmuC+dG6aoLf7OA=; b=P45pYUi152BDQYJnzOabheN9hi2Ta/APr2km4Aum9wzb2JRVaaDbggvut5CEub05z9 RQVRbeaXtn13eSG48OpwZPvueDdsvbSaqGmeU8MxU7o8KZgwWZ5U267n3pBLaDTvOjI2 HG5q4f8LvkAVq6xHmQOVPMPB0oXX5hGKnKw/Cj5YMm2MESlzcMZkWPdqDKtN7SoFiyUc eDPNSTzliWVMXHKGz76OIZZcHJJ/OD6LkL+Os60XkkqgbNOgpzf5GelvEXxpPuemG8GW prHASEgsyjA0/yKh5F2uhwDEhOGqX3p2qeOkv9Stfas3ls2Cc9zi5o4DTh1gmEbJ3HYv WXkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oYirGOrN; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 24si630159ejx.746.2021.05.12.12.29.34; Wed, 12 May 2021 12:29:58 -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=@linaro.org header.s=google header.b=oYirGOrN; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379939AbhELTWP (ORCPT + 99 others); Wed, 12 May 2021 15:22:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343573AbhELQxS (ORCPT ); Wed, 12 May 2021 12:53:18 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FD30C034619 for ; Wed, 12 May 2021 09:47:51 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 82-20020a1c01550000b0290142562ff7c9so3383726wmb.3 for ; Wed, 12 May 2021 09:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=bDKYc6juyaymxPVjFoz4H55W1iGwXmuC+dG6aoLf7OA=; b=oYirGOrNIcNwMpkAHzcPYl0Qh5mhW1k7/1qO+qzT05aC765M6Vsg9BuZtavalWCBO4 o0QFswgOc95tPHp89yndOoxlZuw/0PdSI92mJB+WH7RbEltI1ssXo8LnPWsjipjaUxDk zU7GzUCqM+wMOsQSQfe0hfqEA6EwcKRXkr5EipMQ3f2eGD+NfX7ZFw3a50AXswFhUYWK yhuezdiXWJFTiSqM7Rq1vNWZ3erRdlRa6DfSFrGgIEAGl6M4KcuKaH7Yr9vq6BjeuAxR yi8+3GK4WThFGnMUvhKKqAgImphjXzMWiWeHz9bUnHWmnabS4XKRe88d/uG97oFfql2n lr3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bDKYc6juyaymxPVjFoz4H55W1iGwXmuC+dG6aoLf7OA=; b=DmUt3aeUn+zI9H/NorVMxOXYG0azHu9W18d6uKL2bM4ZHCc/tqJmMLZ70K1mF39Yio c89UoSqLLxcyacSj6Pu3WZsnvsiKiSh16SjM2tzKjbryY46wwbi20xyf95EEAJ3tVFoK kv2WRib7ELkgA99T4HfC2cWqd6P87sYI2a/AdXKYUSRTvuGpsUMjF3OpREa+AKuwHeeI Sd6STFR/GLDomNlDCBL9vBZ8pllMtqTReETtB+N7NHNronMJiVPHgnmjiamL0pUbWGjj 3S/s2wg4SpJZQKRcQ9JnVBuEZzuny5jNZcMBRkM8T4GKnPlMNNxrLhdILQJ+YNuNZEt+ Xpqg== X-Gm-Message-State: AOAM532P0PnsZmjOHH1O9oW71MyqRsp9hFk4u+3fGbjY1/qh5uEChSc0 00TtldrOEvsB34+w4xZ5PLN2nQ== X-Received: by 2002:a7b:c841:: with SMTP id c1mr39895803wml.123.1620838070248; Wed, 12 May 2021 09:47:50 -0700 (PDT) Received: from apalos.home ([94.69.77.156]) by smtp.gmail.com with ESMTPSA id d9sm210203wrp.47.2021.05.12.09.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 09:47:49 -0700 (PDT) Date: Wed, 12 May 2021 19:47:44 +0300 From: Ilias Apalodimas 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 Subject: Re: [PATCH net-next v4 1/4] mm: add a signature in struct page Message-ID: References: <20210511133118.15012-1-mcroce@linux.microsoft.com> <20210511133118.15012-2-mcroce@linux.microsoft.com> 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 Wed, May 12, 2021 at 04:57:25PM +0100, Matthew Wilcox wrote: > On Tue, May 11, 2021 at 05:25:36PM +0300, Ilias Apalodimas wrote: > > Nope not at all, either would work. we'll switch to that > > You'll need something like this because of the current use of > page->index to mean "pfmemalloc". > Yes, I was somehow under the impression that was already merged. We'll include it in the series, with your Co-developed-by tag. Thanks /Ilias > From ecd6d912056a21bbe55d997c01f96b0b8b9fbc31 Mon Sep 17 00:00:00 2001 > From: "Matthew Wilcox (Oracle)" > Date: Fri, 16 Apr 2021 18:12:33 -0400 > Subject: [PATCH] mm: Indicate pfmemalloc pages in compound_head > > The net page_pool wants to use a magic value to identify page pool pages. > The best place to put it is in the first word where it can be clearly a > non-pointer value. That means shifting dma_addr up to alias with ->index, > which means we need to find another way to indicate page_is_pfmemalloc(). > Since page_pool doesn't want to set its magic value on pages which are > pfmemalloc, we can use bit 1 of compound_head to indicate that the page > came from the memory reserves. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > include/linux/mm.h | 12 +++++++----- > include/linux/mm_types.h | 7 +++---- > 2 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index bd21864449bf..4f9b2007efad 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -1670,10 +1670,12 @@ struct address_space *page_mapping(struct page *page); > static inline bool page_is_pfmemalloc(const struct page *page) > { > /* > - * Page index cannot be this large so this must be > - * a pfmemalloc page. > + * This is not a tail page; compound_head of a head page is unused > + * at return from the page allocator, and will be overwritten > + * by callers who do not care whether the page came from the > + * reserves. > */ > - return page->index == -1UL; > + return page->compound_head & 2; > } > > /* > @@ -1682,12 +1684,12 @@ static inline bool page_is_pfmemalloc(const struct page *page) > */ > static inline void set_page_pfmemalloc(struct page *page) > { > - page->index = -1UL; > + page->compound_head = 2; > } > > static inline void clear_page_pfmemalloc(struct page *page) > { > - page->index = 0; > + page->compound_head = 0; > } > > /* > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > index 5aacc1c10a45..1352e278939b 100644 > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -96,10 +96,9 @@ struct page { > unsigned long private; > }; > struct { /* page_pool used by netstack */ > - /** > - * @dma_addr: might require a 64-bit value on > - * 32-bit architectures. > - */ > + unsigned long pp_magic; > + struct page_pool *pp; > + unsigned long _pp_mapping_pad; > unsigned long dma_addr[2]; > }; > struct { /* slab, slob and slub */ > -- > 2.30.2 >