From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 494A1CD11C2 for ; Sun, 7 Apr 2024 17:42:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A35D96B008C; Sun, 7 Apr 2024 13:42:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E5146B0092; Sun, 7 Apr 2024 13:42:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8AD686B0093; Sun, 7 Apr 2024 13:42:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6D0336B008C for ; Sun, 7 Apr 2024 13:42:27 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1AB8A14030A for ; Sun, 7 Apr 2024 17:42:27 +0000 (UTC) X-FDA: 81983455134.05.C2334A4 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf22.hostedemail.com (Postfix) with ESMTP id 3306EC000B for ; Sun, 7 Apr 2024 17:42:25 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fs4FMgY4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of alexander.duyck@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=alexander.duyck@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712511745; a=rsa-sha256; cv=none; b=U8lePoe/q0ZP9DdMudxpm3xx8bo2O6j9ZafHwzAFdegS41VAxCIrOKbGYEhVFLluz7mAgx r9JHJKMemxMZlxdNAdsHayuFA6DI/gW685MQqUddFKVlbnRT66coowgqNNwwgr5p4mqjgA 1sxQsEryBDRj77OheZnabKHSygUfle0= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fs4FMgY4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of alexander.duyck@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=alexander.duyck@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712511745; h=from:from:sender: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:dkim-signature; bh=zmJXrKQQ8NYLGkWMPvSbi6f9GIaPx/v82cnS8xblnmU=; b=q1YkmS0chFBq63N0C689hyhsJyzC88RXdBi831cFOs3JpuIfPSVViM/Jj0z1n6C5sCzHv5 YccUTGTlHYlpGHsyaj21++6WVi8vMpSFR2sIONR4BHKLkyTiheTbxe8kcwolFBCs/yUHIF BM3Gx9yh+UO2VYYWl2BlpkwLeIlN1Zc= Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6ed3cafd766so7554b3a.0 for ; Sun, 07 Apr 2024 10:42:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712511744; x=1713116544; darn=kvack.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=zmJXrKQQ8NYLGkWMPvSbi6f9GIaPx/v82cnS8xblnmU=; b=fs4FMgY4ugrE7b/uDY8EKzSLGoRvEPvIO+pr96g/jOW0XgB8vCTlScQ1P8si9NKQkV gm446OwPRYjon6KJPrwV+iVNkgcHqksMirBA+4wuV2e24ZTmrwTPzxK05r7tR5Hx2rNN X2kMZ22dEH5Eqxpq1n/8zLfm7OnZkVw/0lyL79CI3YO2I+fC3ceSdxUdM6+sKqe2qxsM 4L3AkXOam1vA1ElZRfdzlfty6OuGP9vh2otT8uS6i19zhrWfeohwi61j8dDRRSijhz0c q6XXdBKD/1CpssLczLTItCD/7hPIusLsKB2D3nGPvHQoRFGCjeZCWDg6ipyPZQS6c5Vh Bn4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712511744; x=1713116544; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=zmJXrKQQ8NYLGkWMPvSbi6f9GIaPx/v82cnS8xblnmU=; b=a3HHgeJzvZKiG45IA/ko+rjXjN2g5fXOaFS1yYPn+9ypdNSOrmGGlR49HdWUFen2tB q4IgiRJhacAUFbxPlrUHj+d4D1ANsbA5HZEhfkjpIyYlfKP0XSMujYsjFAFPUNP9EiwY K2LTOqyiF7K+a2mi6X4Oig/3A9oALafqabAlLeYUGzCYl3fGiRdE0zU8ud4/+ORk6CV2 8dAp070Iu8F76Eoi7HWq/MvOvgoGZ/BjYkvia938+NufzZW5hsISL0WH6mS6xbpAsyaK jKM6Vh2Oza+mBMG9YUK1j/PogOyTapRmSDhvl1QID1efiIJgTiD7rALtG65nn+joIANB AMTQ== X-Forwarded-Encrypted: i=1; AJvYcCWe8Gc1Lz5WJ2q5/j4Erqgmo1jMROn7SzIBEkEJv+fkBbTYdBOEH60iUsGOaV9cykWQQO92VF6sqjistvyIkPaOWmE= X-Gm-Message-State: AOJu0Yx9aNaE7aZhvUSwwKGzzExVaBuUNimXlzUROuQw8/ek0D5R/eOR 1tFCMMjQmMzqfva6l9Alxy853LIu/loBC9yluIODzvkSS0Cay/8y X-Google-Smtp-Source: AGHT+IGmD7uuv7daOdFGh7EVoXMeD8DUhS3yBr0tHuJyG+U1xgkotgOsXcTORKS876xd2wFGkcWeGA== X-Received: by 2002:a05:6a00:6908:b0:6eb:1ea:52ed with SMTP id hs8-20020a056a00690800b006eb01ea52edmr4889908pfb.1.1712511743899; Sun, 07 Apr 2024 10:42:23 -0700 (PDT) Received: from ?IPv6:2605:59c8:43f:400:82ee:73ff:fe41:9a02? ([2605:59c8:43f:400:82ee:73ff:fe41:9a02]) by smtp.googlemail.com with ESMTPSA id g24-20020a63dd58000000b005d66caee3d0sm4902477pgj.22.2024.04.07.10.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Apr 2024 10:42:23 -0700 (PDT) Message-ID: <30a6635dedf305e23e623c501e614e55bca1ab41.camel@gmail.com> Subject: Re: [PATCH net-next v1 01/12] mm: Move the page fragment allocator from page_alloc into its own file From: Alexander H Duyck To: Yunsheng Lin , davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , Andrew Morton , linux-mm@kvack.org Date: Sun, 07 Apr 2024 10:42:22 -0700 In-Reply-To: <20240407130850.19625-2-linyunsheng@huawei.com> References: <20240407130850.19625-1-linyunsheng@huawei.com> <20240407130850.19625-2-linyunsheng@huawei.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3306EC000B X-Stat-Signature: f6iq7gxh9g64pbfbycbyh9krqmegj654 X-HE-Tag: 1712511744-818044 X-HE-Meta: U2FsdGVkX19OIz+RFoYZV06V2dgkPv6JDvf/QtUp+jYDb+p56w5uJjXIQR8LE4lfkeUZXEwgDz1v37ikQXbpiqXxvURss1uJLCETi7ea5DrEzW8ZmvUc34WBOukp02iKKYjPMKjM/vI7optne27MSDB+gS45oFrN5BIBHKcBUcguSHuLn4dyfXok9tld3V/tVPf6zfNz0KJgvOuoq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uQi4aaKrwVPNmqCUAEvLfxWgSKRqlsKCilwrTOpux74m38Rv/W1rW/pmfrD85PCTZWFUU9ZBU9qzuIUhEDcErHJfg0zzMGzmJeJ+GRxk43975/AvkrxozAlVshr31Y9Zd9ODgRFbAVbBmLWntdGrQz4nq2VPB/57ZRV4hR62pv3gqN/p6KvXKP/f6DrSjIBFInB9qm3bxd5Egcrhb0KGjIEz0mFOIlZD5yMlU/5jy00+Lfm3/32ZxWJ0/EWyOhQsr39zsTWIMqxOImuueU6AwRA76SpiBv0ySC8/TTvRF9rg81MHZ615RZbry5J2LFF8L/7qILosUKw== 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: List-Subscribe: List-Unsubscribe: On Sun, 2024-04-07 at 21:08 +0800, Yunsheng Lin wrote: > Inspired by [1], but use free_unref_page() to replace free_the_page() > instead of __free_pages(), use VM_BUG_ON() to catch that we can use > free_unref_page() directly, also add its own header file. Instead of doing this all as one patch it would be better to split this into 2. Make the refactor first, and then move the code. Don't do it all in one patch. Adding a refactor that changes out functions called in addition to moving the functions makes it very difficult to provide useful feedback and review. One of the big things with free_unref_page vx free_the_page is a check to see how costly it is to free the page. Right now the page frags are on the verge of crossing that threshold with defaulting to order 3 pages. > As the API is only used by the networking, it may make sense to > move it to the networking directory like the page_pool does in the > future if we can make the free_unref_page() callable outside of the > mm subsystem. And we can utilize that to decouple the 'struct page' > in the networking subsystem in the future. >=20 > 1. https://lore.kernel.org/all/20230411160902.4134381-3-dhowells@redhat.c= om/ The problem with moving this out to networking is the fact that this is memory allocation. In my opinion it would better for it to live there. > CC: David Howells > Signed-off-by: Yunsheng Lin > --- > include/linux/gfp.h | 22 ----- > include/linux/mm_types.h | 18 ---- > include/linux/page_frag_cache.h | 47 ++++++++++ > include/linux/skbuff.h | 1 + > mm/Makefile | 1 + > mm/page_alloc.c | 136 ----------------------------- > mm/page_frag_cache.c | 149 ++++++++++++++++++++++++++++++++ > 7 files changed, 198 insertions(+), 176 deletions(-) > create mode 100644 include/linux/page_frag_cache.h > create mode 100644 mm/page_frag_cache.c I would add comments inline below about the changes you made but it is hard to keep them in any sort of context since what is contained in the "-" block is well spaced out from the "+" block.