Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2019599rwl; Thu, 13 Apr 2023 00:02:25 -0700 (PDT) X-Google-Smtp-Source: AKy350b6KQJnroAjeMA4pj1KZaU5GZ2v1BtDt+NrZI8gD+Q3mYWnN1IUHVx9lcmJO4BvGQPBoxNp X-Received: by 2002:a17:90b:144:b0:23f:7666:c8a1 with SMTP id em4-20020a17090b014400b0023f7666c8a1mr1007110pjb.18.1681369345524; Thu, 13 Apr 2023 00:02:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681369345; cv=none; d=google.com; s=arc-20160816; b=UWYM2aBF88VX3g7Mwc0tDOM5QDjrCUUOr7ShXnngxbvGCvLoisGjs19Xo0EBuNVhTL RpZP9P1NwUVLEB2dOraYVSX5JEHS/D9PKHJvZaGJyrJSQR+9ZdlBDX+YmMHXRVeAZd76 LcQi1yEcCzEh+gdsvV5hpojYQzXgnzB+NmP95R/J2dEWCiB+ulVZN3J1NDKEIvcnYeHJ Mo+ao5yQLpP593DTqO+28v+74u3aLO4p1fXohSEM/IrPK3QDa1TPCbZkiNpdap1KnCDW yCP+4J3MsIZuGnr7rg5peZtNs1nq+wtyD4fo/Z05StKlQZ3SKBkFesTCWxkSdyI8SZoo o/KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LKj3Sa1bj1k3JK9KGPKmmqNZDHVo9Oz8P5aTGkpnMg0=; b=DMZsAP6pzLIg9+IZOmDale2K2/kWzDQGf8/n2acP8Kp/frGNswiyvf6/b3vsrOYE3e So+NOFV4n+RU72cI20ffbK3NhtmfLedho7tMwj80wcDDgKgVEbXdFQVSt/U9zocd6opx ADf+sk9MlEp7GhL5g3jRanHLx2RKyCHTkqlPSBZ1JaDSs19pjWlqGjz/4wMDqf0iXsjc I3l0KsoHbCjU1wX9CIYmfKYynDEHTiLABN4DofFYLKgiKZDxwzl9E6m+QJir7sygXBGG iE6HRwYghbvWm/YxoF+lVOmLkm+D5h6yA7vuiPpjmPkAtMhB/H+XGqnJBS1pBxaMmp0+ eGgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=aNUxu1hl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mu16-20020a17090b389000b0023f6ee835cesi1402054pjb.9.2023.04.13.00.02.13; Thu, 13 Apr 2023 00:02:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=aNUxu1hl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229713AbjDMGzY (ORCPT + 99 others); Thu, 13 Apr 2023 02:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbjDMGzX (ORCPT ); Thu, 13 Apr 2023 02:55:23 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5204683F8 for ; Wed, 12 Apr 2023 23:55:17 -0700 (PDT) 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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