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 E525BC77B61 for ; Thu, 13 Apr 2023 06:55:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3341900002; Thu, 13 Apr 2023 02:55:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE3D36B0074; Thu, 13 Apr 2023 02:55:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DAB05900002; Thu, 13 Apr 2023 02:55:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C67146B0072 for ; Thu, 13 Apr 2023 02:55:19 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 89440C017B for ; Thu, 13 Apr 2023 06:55:19 +0000 (UTC) X-FDA: 80675456358.08.6C1BD11 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf28.hostedemail.com (Postfix) with ESMTP id 8EE45C000B for ; Thu, 13 Apr 2023 06:55:17 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=aNUxu1hl; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf28.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681368917; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LKj3Sa1bj1k3JK9KGPKmmqNZDHVo9Oz8P5aTGkpnMg0=; b=eGZxNqRTd11A+kGyqzDvS+qo/6ZH+SKQ4TD0jjKHI572WGKuy94Z8OO2wLou1UjaRMRUkx WgGSgNvVBD1cgid0DMpiOH3AHrmqFoHAoaJwnFzKAFSnlcNUMpNksioLIvirHe3ZN1nEvn PGW/PszJwHa8NKJa7Gg/tIWSVa74AnM= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=aNUxu1hl; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf28.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681368917; a=rsa-sha256; cv=none; b=URQIqHNfexh3S5J+cIfy8NaOZuI6qo8MxjAR9WdggrrWU1LZxtGhefIdMumw8xMdkm2mzP niz8ftbSsoeBdUICZQ4UbtPh47Jk6gnsTD9OhF50ttCuNgL1QjSMqMJQCQjVXh3VlYyPBt WMyV34tuVmCaevddE/oHlkqp7h2aXjI= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id ED36C1FD63; Thu, 13 Apr 2023 06:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1681368915; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LKj3Sa1bj1k3JK9KGPKmmqNZDHVo9Oz8P5aTGkpnMg0=; b=aNUxu1hlEE5Ur9RwKUlhPDMubtfHNjPcT0xwlcHF4Lo1cwN1FHKGEjCOxGggyjwiJ54VR0 lELtxJuX4VlEvYgRZ3QCCv66hqvv2imSnghQz62o4mSFFLmfGZsjlA+GzQvKqZsWLa6jk5 LxDVmN1lk1ju08U+a3/uforkohWcRV0= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C11BB13421; Thu, 13 Apr 2023 06:55:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id bQJ4LFOnN2TvawAAMHmgww (envelope-from ); Thu, 13 Apr 2023 06:55:15 +0000 Date: Thu, 13 Apr 2023 08:55:15 +0200 From: Michal Hocko To: Jaewon Kim Cc: "T.J. Mercier" , "jstultz@google.com" , "sumit.semwal@linaro.org" , "daniel.vetter@ffwll.ch" , "akpm@linux-foundation.org" , "hannes@cmpxchg.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "jaewon31.kim@gmail.com" Subject: Re: [PATCH v3] dma-buf/heaps: system_heap: avoid too much allocation Message-ID: References: <20230410073228.23043-1-jaewon31.kim@samsung.com> <20230412085726epcms1p7d2bec2526e47bd10a3b6ea6a113c9cc3@epcms1p7> <20230412094440epcms1p445319579ead0d0576bb616ebb07501b4@epcms1p4> <20230412113759epcms1p8cb15b54e3a96c7616419cb030d16f804@epcms1p8> <20230413001658epcms1p611d149fcbbbd06fc17387724f4f16359@epcms1p6> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230413001658epcms1p611d149fcbbbd06fc17387724f4f16359@epcms1p6> X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 8EE45C000B X-Stat-Signature: mdqnwggabhp47thrrfp7nfxxcpmg43bg X-HE-Tag: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2FUIBdx7Gkwx6r2iU6UcXuGXbfwl1vF3sOH16xFg6W6kX6/XN51k+2ymf38vJVCXKPpWqcwV85Lv9TExIgvBE8k7RPXqPsFmXxOHExvKy2kIN8XL2PCDnFJA6JO5LYxRccXyUEPdzyUZm9UZSO3IfFibikbxj0digkdUs6GeIioanakjqUZewQQujh3fiSY7X1GUHouh+54WuUZX3OrVrG8GSRJQycSWNG947wFqCaXtK8+qfO6cj7QY5xpO8gvl4wMSiG1Hyjqk 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 Thu 13-04-23 09:16:58, Jaewon Kim wrote: > >On Wed, Apr 12, 2023 at 4:38?AM Jaewon Kim wrote: > > > >> Yes I think you're right. As a allocator, dma-buf system heap looks to be loose > >> in memory allocation. Limiting dmabuf memory may be required. But I think there > >> is no nice and reasonable way so far. And the dma-buf system heap is being > >> widely used in Android mobile system. AFAIK the camera consumes huge memory > >> through this dma-buf system heap. I actually even looked a huge size request > >> over 2GB in one dma-buf request. > >> > >Hey can you point me to where you saw a request that big? That's a > >non-buggy request?! > > (let me resend as plain text) > It was one of camera scenarios. I internally asked and heard that was not a bug > but normal. I think 2GB looks too big for one graphics buffer but it could be > for other purposes like camera. I think the system heap should support that. Is that any of the upstream drivers or something sitting out of the tree. > Regarding __GFP_RETRY_MAYFAIL, we may need to say dma-buf system heap was > designed to gather many pages up to a requested size. If mm returns NULL due to > __GFP_RETRY_MAYFAIL, dma-buf system heap will release other already allocated > pages, so that it may help to avoid oom. This really depends on the other activity on the system. If you have a more concurrent memory demand at the time then you might be just out of the luck. Really, claiming huge portion of the memory shouldn't be done nilly willy. -- Michal Hocko SUSE Labs