From nobody Sun Sep 14 22:44:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 221EFC54EE9 for ; Tue, 13 Sep 2022 14:38:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234422AbiIMOiX (ORCPT ); Tue, 13 Sep 2022 10:38:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234281AbiIMOgg (ORCPT ); Tue, 13 Sep 2022 10:36:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23E4A1928F; Tue, 13 Sep 2022 07:20:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5447CB80F62; Tue, 13 Sep 2022 14:19:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95AC6C433D6; Tue, 13 Sep 2022 14:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663078778; bh=l2nfi8JHyMeItk0u8t8lhcMaWYblO2aNY0uh6RaqThk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kiO4I0x3Z3PzryJLCMD3+hBes/vAvQSYOq1/aTDlsaQH8nkEZTPErPKvnRTD+w20A V0aEkIKgc5t+AhW/u9otoGV0kKVrSOpPipy8JUD6tGxysl/Ye0RSNbk2r3aMbsuC8M wWM9w71pJYUIG67VvgaiYulLOduA/myTq+4uwfW0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 079/121] net: introduce __skb_fill_page_desc_noacc Date: Tue, 13 Sep 2022 16:04:30 +0200 Message-Id: <20220913140400.770286188@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140357.323297659@linuxfoundation.org> References: <20220913140357.323297659@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Begunkov [ Upstream commit 84ce071e38a6e25ea3ea91188e5482ac1f17b3af ] Managed pages contain pinned userspace pages and controlled by upper layers, there is no need in tracking skb->pfmemalloc for them. Introduce a helper for filling frags but ignoring page tracking, it'll be needed later. Signed-off-by: Pavel Begunkov Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- include/linux/skbuff.h | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index ae598ed86b50b..be7cc31d58961 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -2232,6 +2232,22 @@ static inline unsigned int skb_pagelen(const struct = sk_buff *skb) return skb_headlen(skb) + __skb_pagelen(skb); } =20 +static inline void __skb_fill_page_desc_noacc(struct skb_shared_info *shin= fo, + int i, struct page *page, + int off, int size) +{ + skb_frag_t *frag =3D &shinfo->frags[i]; + + /* + * Propagate page pfmemalloc to the skb if we can. The problem is + * that not all callers have unique ownership of the page but rely + * on page_is_pfmemalloc doing the right thing(tm). + */ + frag->bv_page =3D page; + frag->bv_offset =3D off; + skb_frag_size_set(frag, size); +} + /** * __skb_fill_page_desc - initialise a paged fragment in an skb * @skb: buffer containing fragment to be initialised @@ -2248,17 +2264,7 @@ static inline unsigned int skb_pagelen(const struct = sk_buff *skb) static inline void __skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size) { - skb_frag_t *frag =3D &skb_shinfo(skb)->frags[i]; - - /* - * Propagate page pfmemalloc to the skb if we can. The problem is - * that not all callers have unique ownership of the page but rely - * on page_is_pfmemalloc doing the right thing(tm). - */ - frag->bv_page =3D page; - frag->bv_offset =3D off; - skb_frag_size_set(frag, size); - + __skb_fill_page_desc_noacc(skb_shinfo(skb), i, page, off, size); page =3D compound_head(page); if (page_is_pfmemalloc(page)) skb->pfmemalloc =3D true; --=20 2.35.1