Received: by 10.223.185.116 with SMTP id b49csp1943879wrg; Thu, 22 Feb 2018 05:50:50 -0800 (PST) X-Google-Smtp-Source: AH8x224D24OeXgmtp1FJ/PbaRPDROnRYppvsqsYu9xPdStFgz1+D2yxLknhYBj1MREeF7MEk2sYd X-Received: by 10.98.216.137 with SMTP id e131mr7073426pfg.17.1519307450135; Thu, 22 Feb 2018 05:50:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519307450; cv=none; d=google.com; s=arc-20160816; b=FFSy7WMQfhpYQrXqgPuks+en7UyP3TxCsqXp/+bsy9EtFVGD0R/+zGSWWJ8s41BQG+ b6ZUSfVS24/Cv7aMwimZvUAFNKngM2wE8ZKysge15jModhPupktrh5EEqbzvbIh0WHo6 +jUxD+bygVt8LCH+ljp0/m2PZxkSdalZQkdGwp17HBkyiIjn67ZFePE1hZn7wnw2mkhq nVyELEZTzvc6q0jx+5lmrn8CUOsQK7kLqKm8vILw4UUoiRfW6DAAOKpznbHd6+8vjRP7 BQIXE/U0LeHPtfxTHoDj06g92iFhW14YntXHTbDacOY1C5Zmu7cztiXmRkWNVBr43q3u DtKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=kFBuwECB22NaLFt+D0FseYoSc1vV8E2nh+NU2a+7znY=; b=PVYkkVnhgdHLhOy0yLNH3QnHoIic8EC4y+LqAqcRmCgsgOzCuil74KO1iRO5/0yrsi swtPg7qcSKrzi5FBm06imN00qSGHQvVZKAA9UNf4cC1oPajergDeliDM4BoI967sme1o E/jJJRadqYAk3Ydsx/+yBCHesDn0ZyM02xISwy+FfsxXQjLvoYvJ3ZLjTPOGfU03E7Na /NtCbQ/Y3beGyvkYaKv5Kgb/psDc5B9hP7A0tB6Z0B6GZ0+n06IiMNgvnO2ic8Z5I1NQ 4RqCwtbK1f7B0gk3lpvjN3vb6z8IXjPqUumw0VMWWwIPALDpruNqAbS7JgN7hDY9WCOF zYZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10-v6si74941plh.410.2018.02.22.05.50.35; Thu, 22 Feb 2018 05:50:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932646AbeBVNtt (ORCPT + 99 others); Thu, 22 Feb 2018 08:49:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:49590 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932564AbeBVNts (ORCPT ); Thu, 22 Feb 2018 08:49:48 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A7691AC20; Thu, 22 Feb 2018 13:49:45 +0000 (UTC) Date: Thu, 22 Feb 2018 14:49:44 +0100 From: Michal Hocko To: Shakeel Butt Cc: Jan Kara , Amir Goldstein , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Greg Thelen , Johannes Weiner , Vladimir Davydov , Mel Gorman , Vlastimil Babka , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] fs: fsnotify: account fsnotify metadata to kmemcg Message-ID: <20180222134944.GK30681@dhcp22.suse.cz> References: <20180221030101.221206-1-shakeelb@google.com> <20180221030101.221206-4-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180221030101.221206-4-shakeelb@google.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 20-02-18 19:01:01, Shakeel Butt wrote: > A lot of memory can be consumed by the events generated for the huge or > unlimited queues if there is either no or slow listener. This can cause > system level memory pressure or OOMs. So, it's better to account the > fsnotify kmem caches to the memcg of the listener. How much memory are we talking about here? > There are seven fsnotify kmem caches and among them allocations from > dnotify_struct_cache, dnotify_mark_cache, fanotify_mark_cache and > inotify_inode_mark_cachep happens in the context of syscall from the > listener. So, SLAB_ACCOUNT is enough for these caches. > > The objects from fsnotify_mark_connector_cachep are not accounted as > they are small compared to the notification mark or events and it is > unclear whom to account connector to since it is shared by all events > attached to the inode. > > The allocations from the event caches happen in the context of the event > producer. For such caches we will need to remote charge the allocations > to the listener's memcg. Thus we save the memcg reference in the > fsnotify_group structure of the listener. Is it typical that the listener lives in a different memcg and if yes then cannot this cause one memcg to OOM/DoS the one with the listener? > This patch has also moved the members of fsnotify_group to keep the > size same, at least for 64 bit build, even with additional member by > filling the holes. > > Signed-off-by: Shakeel Butt [...] -- Michal Hocko SUSE Labs