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 6D2A4C54EED for ; Wed, 25 Jan 2023 09:56:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A8BE86B0071; Wed, 25 Jan 2023 04:56:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A3C616B0072; Wed, 25 Jan 2023 04:56:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8DBE86B0073; Wed, 25 Jan 2023 04:56:56 -0500 (EST) 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 7B3A16B0071 for ; Wed, 25 Jan 2023 04:56:56 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 51D49120D12 for ; Wed, 25 Jan 2023 09:56:56 +0000 (UTC) X-FDA: 80392867632.20.B07E4F6 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by imf01.hostedemail.com (Postfix) with ESMTP id EBD824001A for ; Wed, 25 Jan 2023 09:56:51 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=Nx47mNum; spf=pass (imf01.hostedemail.com: domain of jaewon31.kim@samsung.com designates 203.254.224.34 as permitted sender) smtp.mailfrom=jaewon31.kim@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674640612; h=from:from:sender:sender:reply-to: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=Dq3Gs80vpXHYVePlHXzFEhSYh9nwER7eIy5vkiUmkvc=; b=8QHahjDlgkTWfpZMcJA43OL7RcywYR3Q35MstVkYF9eJH8+JHjGcXo+kZ4X5wp8clPZsxb XfJ3IXzEWysGer3zKNKaiL7onLwOBd8uUNNqOhy77Pm6S88WvZ5g0Vum3yh3xxGnpMxhqp hMW6BsYAsSUl+Dlylgd4gcAT6a8qPaA= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=Nx47mNum; spf=pass (imf01.hostedemail.com: domain of jaewon31.kim@samsung.com designates 203.254.224.34 as permitted sender) smtp.mailfrom=jaewon31.kim@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674640612; a=rsa-sha256; cv=none; b=xBIsapwfZCAQrzsDutg/xYxb9WDBLMd3gCzhesj6CZ6f9J6CqkGpkN4SGf6Y0kNKUkVc08 e2yElYRExw1MNB2sYawA2NrMrXeiBZTg4VlB5Bm86a40yHTi4nISdgtgNGwxKyXRzxfnGf 4Q3847U33U7TfxqdkBpOF9NCtCgQZYI= Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230125095648epoutp0471515ee6b862f73a1b5ee7cfc438a0cf~9hMKzsOYF1488814888epoutp043 for ; Wed, 25 Jan 2023 09:56:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230125095648epoutp0471515ee6b862f73a1b5ee7cfc438a0cf~9hMKzsOYF1488814888epoutp043 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1674640608; bh=Dq3Gs80vpXHYVePlHXzFEhSYh9nwER7eIy5vkiUmkvc=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=Nx47mNumsDoUBdaRcA1MxUGzASLjyEG7ewelkQxJXVGdOS8XNu6u339Uh6vHMC0vC c/0rLig8Js4Qn8IC8LC8M3Mx0090zXp/JFfsqejaQ6D674sfkQc+te2cBV1pU+6skT JmXDz6NQtLTqe6ZGD5iT6rEUjDh/B2Vxj03mBqME= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20230125095647epcas1p27bf66bf496dabea5bf132daa9ca22b18~9hMKMH5Ik2705127051epcas1p2p; Wed, 25 Jan 2023 09:56:47 +0000 (GMT) Received: from epsmges1p4.samsung.com (unknown [182.195.38.240]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4P1zl319tnz4x9Pq; Wed, 25 Jan 2023 09:56:47 +0000 (GMT) X-AuditID: b6c32a38-39fff70000029402-f8-63d0fcde4c81 Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p4.samsung.com (Symantec Messaging Gateway) with SMTP id 0A.62.37890.EDCF0D36; Wed, 25 Jan 2023 18:56:47 +0900 (KST) Mime-Version: 1.0 Subject: Re: [PATCH] dma-buf: system_heap: avoid reclaim for order 4 Reply-To: jaewon31.kim@samsung.com From: Jaewon Kim To: "T.J. Mercier" , John Stultz CC: Jaewon Kim , "sumit.semwal@linaro.org" , "daniel.vetter@ffwll.ch" , "akpm@linux-foundation.org" , "hannes@cmpxchg.org" , "mhocko@kernel.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "jaewon31.kim@gmail.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20230125095646epcms1p2a97e403a9589ee1b74a3e7ac7d573f9b@epcms1p2> Date: Wed, 25 Jan 2023 18:56:46 +0900 X-CMS-MailID: 20230125095646epcms1p2a97e403a9589ee1b74a3e7ac7d573f9b Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEJsWRmVeSWpSXmKPExsWy7bCmnu79PxeSDU5PYLKYs34Nm8XCh3eZ LVZv8rXo3jyT0aL3/Ssmiz8nNrJZXN41h83i3pr/rBavvy1jtjh19zO7xbv1X9gcuD0Ov3nP 7LH32wIWj52z7rJ7LNhU6rFpVSebx6ZPk9g97lzbw+ZxYsZvFo++LasYPT5vkgvgisq2yUhN TEktUkjNS85PycxLt1XyDo53jjc1MzDUNbS0MFdSyEvMTbVVcvEJ0HXLzAG6WEmhLDGnFCgU kFhcrKRvZ1OUX1qSqpCRX1xiq5RakJJTYFagV5yYW1yal66Xl1piZWhgYGQKVJiQndGxuoe5 YIFwxdvV9g2M//i6GDk5JARMJBZf2s/cxcjFISSwg1HiwoJeli5GDg5eAUGJvzuEQWqEBVwk bq/uYwaxhQSUJM7+uMIOEdeVaOpezQJiswloS7xfMIkVxBYR8JbY0bCKEWQms8BJZolHM3cy QSzjlZjR/pQFwpaW2L58KyOIzSkQKHFt5hmoGlGJm6vfssPY74/NZ4SwRSRa751lhrAFJR78 3A0Vl5I4130cqrdcYsec/WwQdoXE7/5lUHP0Ja70zwSr4RXwleheswZsDouAqkRX2yyoXheJ mz8+g8WZBeQltr+dwwwKB2YBTYn1u/QhShQldv6eywhRwifx7msPK8xbO+Y9gRqjJtHy7CtU XEbi779nULaHRPOaJhZIOF9jkpjxcQrLBEaFWYignoVk8yyEzQsYmVcxiqUWFOempxYbFpjA Izc5P3cTIzjxalnsYJz79oPeIUYmDsZDjBIczEoivD2zzycL8aYkVlalFuXHF5XmpBYfYjQF +nkis5Rocj4w9eeVxBuaWBqYmBmZWBhbGpspifOK255MFhJITyxJzU5NLUgtgulj4uCUamDy SuCP32VYdMOu18Ai+Leu+DGdZTJz/wneaHSssUjdd39m349vXA2mrEcc7oZcM9+4WH7qtZUX Gf9vWpm18OJXu/R733Ye4H28t/f75xQ746Na79X3aTc6ver3+zdnz899J09IzZy5qDj8wjIB NoG0jaYftu+2dQoo2bzpvs7cb7Hf1Geo3nUuXVL4rGH31vuHTLxY6u4yPZggdHMGz35ug08S 954dEuezWKzwfPlZ3/u2l36kOd9ZtyI7/U/Mp51PJZ1X6W3/8kz81/8p7HfvHX7AzP3z9eQy XavJO1PWTHm3+8rZxe3/uVaEGti/+T1tL+PVrRrXqhsX73kUcDhM6TXP6hNRD/Qs80Q3+l/f +FhFiaU4I9FQi7moOBEASAq2tUUEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230117082521epcas1p22a709521a9e6d2346d06ac220786560d References: <20230117082508.8953-1-jaewon31.kim@samsung.com> <20230117083103epcms1p63382eee1cce1077248a4b634681b0aca@epcms1p6> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: EBD824001A X-Stat-Signature: jmyo7sqqpbn5b4bxn5jtecd9q695fajq X-Rspam-User: X-HE-Tag: 1674640611-747263 X-HE-Meta: U2FsdGVkX197UDE78qswQxVB06AkpzALO2D2+ZgDV7mVRGu6lSdzLBy3ZJWJ71qMCXIQW3UZVitLoNgssgUTK83XmGKEhW4g9Nw3IAZ9QPQ/2bFJtNhkIUwo1xmpIyWvMyPntbqLavnhb78u9/Y31OGt/Xs/EAjbjWx72sPCJonc0HHN/DVYKkm4Oc4+V0B5pY1qsIZMakTdUQ1ODL5Yheh+yFxTwjTBTj+E6IXxiqxWwZe+RbkLI9S8Y+pVCQ8c2ENv0JAvZhwE+2S+BQzvTBrxsIuNr1l4lHyHHFrkmdh8v9Gfw5yeG8FtluIG+iV1Ga8IDrYO8okipKKO+QommdUO4r62nn0mT2QE6D9X3lD7x14/99h2lURDsUBmYuaXvHJDHhKyb+bST7KDOBWD6pMZ1Fyhv9WjpQcuWo1fNjvw8HLfQGYmPDCKODok8frcyVynmITa2bjM2+4wUyFTxDd3b2PxiSgc2905rSpv8rwJCZ/5sU/1Zo4OXlhzFfWHVa0Cl6uWj/gNQB3BIR91qYa7c3Xwg/s8yXkjXZDfCV5pIVN58uG8Om6o4iO8jGEGYXosX2dzyqmbJdxNSFro807lO0UAS2qZr8chr9q0wcm5q+M3cR8tPnLj0fk6EcpSX8VroaRSn4Fx9V7tAxUvHvcFKDsATanZoeccVpSUnfGoXaUsixM5o3Rkn+9/UmSR+jtPkcxljKYoppdI9Yd8Ci7RBatxiP3e9tVCbzbftYz+TWrL92+p3Oz1CKfJM+mTTR0l9TJTwObr6f4Whcw6guyeZNjgBSHbkHfnkkUNfY4drj1Rwdr2kU+enzIHN3EzZHNt7G0NbP1jKYXCN7vSjCkRDqxfIfu8y5ZrLzwHpMSZDVX1ZSXZ7fopGPM5XssE8KUIX08RSZLaJcnxWHLdP/8rHlgtlQMvt+x+ncaDYdT0WEqCGHIxhlqozXpErWLcjceeB3mjqH42yn0x41O r9nQg8Ls xubhLck2LjHNa3n6NW1U7NX+aWIUWVzIyxwMy1VAi+Q3GhH3dZYA9BTGqqPG+4QUEjGZWZSvUxjW+fnR+XXklkKTVcWEAkXdaEG+U+lL6e94BZKej+yKVP7FgX+Ou/IEcSiaoETqhsdiyvGOt/HBfhEF8LeX3DOLaZWyPkLBEgGNn8EJoCkdqPY6++KjydeD8W8tx9yTdPm/706/qJIAILyiwP95zBNzc5CdPZjEWY5iKZiQLaxg/s8mHcaVR7jJJO3WY/6zF1Mo0YOuyu7dB2An3PfMaIITERRMepS/Y04BKGgMWLSo0dXRyOy+tGVyO8YiCvR/jv3D9PmKPHKE4R665V/6AWAOTPFt2jRNwjLQe6JiVgM0jN15Kdsun4QvFO+8zdNajA2M0QEZYpsHro2PZ/g== 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, Jan 17, 2023 at 10:54 PM John Stultz wrote: > > > > On Tue, Jan 17, 2023 at 12:31 AM Jaewon Kim wrote: > > > > Using order 4 pages would be helpful for many IOMMUs, but it could spend > > > > quite much time in page allocation perspective. > > > > > > > > The order 4 allocation with __GFP_RECLAIM may spend much time in > > > > reclaim and compation logic. __GFP_NORETRY also may affect. These cause > > > > unpredictable delay. > > > > > > > > To get reasonable allocation speed from dma-buf system heap, use > > > > HIGH_ORDER_GFP for order 4 to avoid reclaim. > > > > Thanks for sharing this! > > The case where the allocation gets stuck behind reclaim under pressure > > does sound undesirable, but I'd be a bit hesitant to tweak numbers > > that have been used for a long while (going back to ion) without a bit > > more data. > > > > It might be good to also better understand the tradeoff of potential > > on-going impact to performance from using low order pages when the > > buffer is used. Do you have any details like or tests that you could > > share to help ensure this won't impact other users? > > > > TJ: Do you have any additional thoughts on this? > > > I don't have any data on how often we hit reclaim for mid order > allocations. That would be interesting to know. However the 70th > percentile of system-wide buffer sizes while running the camera on my > phone is still only 1 page, so it looks like this change would affect > a subset of use-cases. > > Wouldn't this change make it less likely to get an order 4 allocation > (under memory pressure)? The commit message makes me think the goal of > the change is to get more of them. Hello John Stultz I've been waiting for your next reply. With my commit, we may gather less number of order 4 pages and fill the requested size with more number of order 0 pages. I think, howerver, stable allocation speed is quite important so that corresponding user space context can move on within a specific time. Not only compaction but reclaim also, I think, would be invoked more if the __GFP_RECLAIM is added on order 4. I expect the reclaim could be decreased if we move to order 0. Thank you Jaewon Kim > > Actually with the low order being 0, I don't think __GFP_COMP makes > sense in LOW_ORDER_GFP. But I guess that flag isn't harmful there. > > > thanks > > -john