From patchwork Thu Feb 4 10:56:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hao X-Patchwork-Id: 12066995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A937C433E0 for ; Thu, 4 Feb 2021 11:06:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B23BA64F39 for ; Thu, 4 Feb 2021 11:06:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B23BA64F39 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EBD2F6B0005; Thu, 4 Feb 2021 06:06:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E6DA66B006C; Thu, 4 Feb 2021 06:06:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5DAB6B006E; Thu, 4 Feb 2021 06:06:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0188.hostedemail.com [216.40.44.188]) by kanga.kvack.org (Postfix) with ESMTP id BECEE6B0005 for ; Thu, 4 Feb 2021 06:06:13 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 88CCF8249980 for ; Thu, 4 Feb 2021 11:06:13 +0000 (UTC) X-FDA: 77780306226.02.rail63_270f97c275db Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 5DEE110097AA4 for ; Thu, 4 Feb 2021 11:06:13 +0000 (UTC) X-HE-Tag: rail63_270f97c275db X-Filterd-Recvd-Size: 4288 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Feb 2021 11:06:12 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id i7so1836209pgc.8 for ; Thu, 04 Feb 2021 03:06:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Mznl2x0t9n//eV3qB2RdXE0dndjXVUaokt938SUBRto=; b=LHSAVBW27sCFb6iQwtxU74DuseAv5wMI8+f/Gf6Il8eJr/Ghiw0oq2Os4cGUdRKvbr 8yy6AfxB23g2+WlCl+iwMlWlGnuMDPsbnEvoWpFebviW1h5+hr5Zm3j8eS/yKDylrXxK tKvV+yPf1bimY9+GiJFr5ajZMku4oybxeA7SdYoL5tgiwhTf+WqW+RGMouEFVrRgk7OX Unc5Da5Zl/HTVhe+sY95/ttinUPUw2oMWCbkIm/gmx01zxz+sNv292Jzs+YcXwUYKBXz 5dKT/yybIir2qbN5O2VOnJ2B/p3R0tlk/IgnP1EdWy5digzoXPqPIPWvdhmbOa9YYu4W b1/Q== 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:mime-version :content-transfer-encoding; bh=Mznl2x0t9n//eV3qB2RdXE0dndjXVUaokt938SUBRto=; b=eqS61fH+Ebt1+O3PQ/+5ADxi55AbLP15n9SGfaAkBSPsGAGe1XMw6R1FfLEmZO4LRu EZ8eZvazzvLDU/+sxAtJ96cGKnAry+C0RAfZjV3OgumzfDMqoeROf6JN3ZKL0NOklXRt lTPAcXRrn0+9OL4rXlBQule0bZv3AsxRyJOEyL3QbXKetpUVsu+K1lH9WhK5XJjz8js5 Oi2PaiK2GFcNwUFGfhKEwFo9APp5mY+PM+pYnVuVyLYkiqGFhDhXHke4yovs/kdAKhSt 4egETLYOB8F3nOzojWOG16jrlOqNoMwRbpBxXbWDU38tnDVVN3bBO57nCGRBh51XST+r +F8w== X-Gm-Message-State: AOAM531UUaiS5rcWQDXv1C8H4jtgFleUFKjyYgOWyktdccxCqOHySsgk Zph8Uvr4kVlNS178TZR9WNM= X-Google-Smtp-Source: ABdhPJyYAVIyAFXnm75S+MSVk4RMguWyni4CWitq1UtNWeN1KmeES5X6sMx7Uyxt8osXxWk90pmCJQ== X-Received: by 2002:a05:6a00:8d0:b029:1b6:3581:4f41 with SMTP id s16-20020a056a0008d0b02901b635814f41mr7533435pfu.56.1612436772030; Thu, 04 Feb 2021 03:06:12 -0800 (PST) Received: from pek-lpggp6.wrs.com (unknown-105-123.windriver.com. [147.11.105.123]) by smtp.gmail.com with ESMTPSA id y15sm5283351pju.20.2021.02.04.03.06.06 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Feb 2021 03:06:11 -0800 (PST) From: Kevin Hao To: "David S . Miller" , Jakub Kicinski , Andrew Morton Cc: netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH net-next v3 0/4] net: Avoid the memory waste in some Ethernet drivers Date: Thu, 4 Feb 2021 18:56:34 +0800 Message-Id: <20210204105638.1584-1-haokexin@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi, v3: - Adjust patch 1 and 2 according to Alexander's suggestion. - Add Tested-by from Subbaraya. - Add Reviewed-by from Ioana. v2: - Inline page_frag_alloc() and {netdev,napi}_alloc_frag() - Adopt Vlastimil's suggestion and add his Acked-by In the current implementation of napi_alloc_frag(), it doesn't have any align guarantee for the returned buffer address. We would have to use some ugly workarounds to make sure that we can get a align buffer address for some Ethernet drivers. This patch series tries to introduce some helper functions to make sure that an align buffer is returned. Then we can drop the ugly workarounds and avoid the unnecessary memory waste. Kevin Hao (4): mm: page_frag: Introduce page_frag_alloc_align() net: Introduce {netdev,napi}_alloc_frag_align() net: octeontx2: Use napi_alloc_frag_align() to avoid the memory waste net: dpaa2: Use napi_alloc_frag_align() to avoid the memory waste .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 3 +- .../marvell/octeontx2/nic/otx2_common.c | 3 +- include/linux/gfp.h | 12 +++++-- include/linux/skbuff.h | 36 +++++++++++++++++-- mm/page_alloc.c | 8 +++-- net/core/skbuff.c | 26 ++++++-------- 6 files changed, 61 insertions(+), 27 deletions(-)