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 5ABC6C433EF for ; Tue, 31 May 2022 15:47:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEA676B0072; Tue, 31 May 2022 11:47:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B99466B0073; Tue, 31 May 2022 11:47:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5EFD6B0074; Tue, 31 May 2022 11:47:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 96BD96B0072 for ; Tue, 31 May 2022 11:47:08 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6EC0034A14 for ; Tue, 31 May 2022 15:47:08 +0000 (UTC) X-FDA: 79526466936.07.1B118F4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id A46E24002F for ; Tue, 31 May 2022 15:47:03 +0000 (UTC) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 3CD0C613E2; Tue, 31 May 2022 15:47:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62864C385A9; Tue, 31 May 2022 15:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654012025; bh=YImjX7tnq5yEXBJYEKKMWsOcxx5Ng1oCvYpBACKL/8k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kiZERfjowG6otrWW53RhAh557Go68b6AQ9BLkqcTxX/rnmV15j+ejWhOZOzKJ+2yW XTI5jF+phz1DI4fHAeKwIAfM4P+DUD6bH14EOg0Zbefaq+ilDdYVTyerWNsSoVkfTi G+FoOy6KWmL7dsrQTdEfefH/i8QKzzWcDnwDAA3VJfsOMHbIvBP4gDbCrt4uTtv2zE /7L7x9iA7RwcM9rJMhESUh+FR9Zk6GoPQxG91JyhVwohYG05wXeGQKGS8ViGacVmRb kD6+N/Ojm9jmgZ3XBcSNGinqEZeetEYq3tKLcnq93M0HUFleREJeCgZOiGSWCHa3r7 WB43ggHhhhHAw== Date: Tue, 31 May 2022 08:47:04 -0700 From: Jakub Kicinski To: Chen Lin Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, alexander.duyck@gmail.com, netdev@vger.kernel.org Subject: Re: [PATCH v2] mm: page_frag: Warn_on when frag_alloc size is bigger than PAGE_SIZE Message-ID: <20220531084704.480133fa@kernel.org> In-Reply-To: <1654011382-2453-1-git-send-email-chen45464546@163.com> References: <20220531081412.22db88cc@kernel.org> <1654011382-2453-1-git-send-email-chen45464546@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kiZERfjo; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of kuba@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=kuba@kernel.org X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A46E24002F X-Rspam-User: X-Stat-Signature: ynaru4sqr83ps6ggoe8pcspnha9id56e X-HE-Tag: 1654012023-801176 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: On Tue, 31 May 2022 23:36:22 +0800 Chen Lin wrote: > At 2022-05-31 22:14:12, "Jakub Kicinski" wrote: > >On Tue, 31 May 2022 22:41:12 +0800 Chen Lin wrote: > >> The sample code above cannot completely solve the current problem. > >> For example, when fragsz is greater than PAGE_FRAG_CACHE_MAX_SIZE(32768), > >> __page_frag_cache_refill will return a memory of only 32768 bytes, so > >> should we continue to expand the PAGE_FRAG_CACHE_MAX_SIZE? Maybe more > >> work needs to be done > > > >Right, but I can think of two drivers off the top of my head which will > >allocate <=32k frags but none which will allocate more. > > In fact, it is rare to apply for more than one page, so is it necessary to > change it to support? I don't really care if it's supported TBH, but I dislike adding a branch to the fast path just to catch one or two esoteric bad callers. Maybe you can wrap the check with some debug CONFIG_ so it won't run on production builds? > we can just warning and return, also it is easy to synchronize this simple > protective measures to lower Linux versions.