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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0A56C433DB for ; Wed, 27 Jan 2021 11:27:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E2EB2078E for ; Wed, 27 Jan 2021 11:27:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236645AbhA0L1O (ORCPT ); Wed, 27 Jan 2021 06:27:14 -0500 Received: from mx2.suse.de ([195.135.220.15]:42604 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236642AbhA0LYh (ORCPT ); Wed, 27 Jan 2021 06:24:37 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1611746630; h=from:from:reply-to: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; bh=PqpTmCh3ho+cnaTSVLoFW4UVAwVWXacgRQ8K11OQqug=; b=A0Wcko1cqX604secuwtbyeQ8wWpszYFQnnwp2qTxgLmHN1G5M16dx+DyGbUJIGpvKkZoaG CM6tKnCe31ck37wl5r0KOLE6uoY/GT7xRtl8MI0+v/+kqt+G9dsvqNPXncHv5fSxgC5w28 TY5IjZy1AyF6cB5rdaDKLAzZq0G1F+0= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C03E4AC9B; Wed, 27 Jan 2021 11:23:49 +0000 (UTC) Date: Wed, 27 Jan 2021 12:23:47 +0100 From: Michal Hocko To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Kalesh Singh , surenb@google.com, minchan@kernel.org, gregkh@linuxfoundation.org, hridya@google.com, jannh@google.com, kernel-team@android.com, Alexey Dobriyan , Jonathan Corbet , Sumit Semwal , Mauro Carvalho Chehab , Andrew Morton , Kees Cook , Alexey Gladkov , Szabolcs Nagy , "Eric W. Biederman" , Daniel Jordan , Michel Lespinasse , Bernd Edlinger , Andrei Vagin , Yafang Shao , Hui Su , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-api@vger.kernel.org Subject: Re: [PATCH] procfs/dmabuf: Add /proc//task//dmabuf_fds Message-ID: References: <20210126225138.1823266-1-kaleshsingh@google.com> <20210127090526.GB827@dhcp22.suse.cz> <6b314cf2-99f0-8e63-acc7-edebe2ca97d7@amd.com> <7dd33165-4fb9-a424-9b5e-08c69583c979@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7dd33165-4fb9-a424-9b5e-08c69583c979@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Wed 27-01-21 12:08:50, Christian König wrote: > Am 27.01.21 um 12:02 schrieb Michal Hocko: > > On Wed 27-01-21 11:53:55, Christian König wrote: > > [...] > > > In general processes are currently not held accountable for memory they > > > reference through their file descriptors. DMA-buf is just one special case. > > True > > > > > In other words you can currently do something like this > > > > > > fd = memfd_create("test", 0); > > > while (1) > > >     write(fd, buf, 1024); > > > > > > and the OOM killer will terminate random processes, but never the one > > > holding the memfd reference. > > memfd is just shmem under cover, no? And that means that the memory gets > > accounted to MM_SHMEMPAGES. But you are right that this in its own > > doesn't help much if the fd is shared and the memory stays behind a > > killed victim. > > I think so, yes. But I just tested this and it doesn't seem to work > correctly. > > When I run the few lines above the OOM killer starts to terminate processes, > but since my small test program uses very very little memory basically > everything else gets terminated (including X, desktop, sshd etc..) before it > is terminated as well. Something worth looking into. Maybe those pages are not really accounted properly after all. Can you send a separate email about details with oom reports please? -- Michal Hocko SUSE Labs