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 817A4C433F5 for ; Thu, 21 Apr 2022 22:37:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D7AA56B0072; Thu, 21 Apr 2022 18:37:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D289C6B0073; Thu, 21 Apr 2022 18:37:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA2BD6B0074; Thu, 21 Apr 2022 18:37:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id A2A286B0072 for ; Thu, 21 Apr 2022 18:37:15 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6D13161A51 for ; Thu, 21 Apr 2022 22:37:15 +0000 (UTC) X-FDA: 79382348430.28.A066980 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by imf04.hostedemail.com (Postfix) with ESMTP id E3B6340021 for ; Thu, 21 Apr 2022 22:37:12 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 2915E1F4613A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1650580633; bh=2uLR6lpcb3Wga8OxsHI3MxrAfCZ5deGu8mBakPVEbSo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=ZbnMABbPXsy/tNgW/pJ2Y9S5Ra0QtsmTs+YKfO+fNRjQrxHqmRbf0A/L7GD52PDjP Eu6Laii+7GLGd07qlyC44m7WsWpwOIYuj6l7ZHLjYFrAxxevqgZasXpBoYygdpq0Wp zyf9Ag3OQ9ZcWtMhuxrxaIWwasRbjFP96mycD4bxqALFN3D1qSOtNTshxDywIl3DDJ vma0kG96vZ1cCnKlvct6me+4x9PNpI+QED0yfYl4bktO2GpEfk7d5ucfGUGtiLwyuK kjRPBKC7IVM/YB+a4fhTML+KyHTzVeuBrTly3py1ORd0z6zDI/rOFkY7c6Gl6HCyX7 DBzn5ClE/wA6Q== From: Gabriel Krisman Bertazi To: Amir Goldstein Cc: Andrew Morton , Hugh Dickins , Al Viro , kernel@collabora.com, Khazhismel Kumykov , Linux MM , linux-fsdevel , Theodore Tso Subject: Re: [PATCH v3 0/3] shmem: Allow userspace monitoring of tmpfs for lack of space. Organization: Collabora References: <20220418213713.273050-1-krisman@collabora.com> <20220418204204.0405eda0c506fd29e857e1e4@linux-foundation.org> <87h76pay87.fsf@collabora.com> Date: Thu, 21 Apr 2022 18:37:09 -0400 In-Reply-To: (Amir Goldstein's message of "Thu, 21 Apr 2022 08:33:56 +0300") Message-ID: <87levyoyga.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: E3B6340021 X-Stat-Signature: wt7s1mazfbmm6o7swyd6cg557j5kgtmn Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=ZbnMABbP; spf=pass (imf04.hostedemail.com: domain of krisman@collabora.com designates 46.235.227.227 as permitted sender) smtp.mailfrom=krisman@collabora.com; dmarc=pass (policy=none) header.from=collabora.com X-Rspam-User: X-HE-Tag: 1650580632-672374 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: Amir Goldstein writes: > On Tue, Apr 19, 2022 at 6:29 PM Gabriel Krisman Bertazi > wrote: >> > Well that sucks. We need a kernel-side workaround for applications >> > that fail to check and report storage errors? >> > >> > We could do this for every syscall in the kernel. What's special about >> > tmpfs in this regard? >> > >> > Please provide additional justification and usage examples for such an >> > extraordinary thing. >> >> For a cloud provider deploying containerized applications, they might >> not control the application, so patching userspace wouldn't be a >> solution. More importantly - and why this is shmem specific - >> they want to differentiate between a user getting ENOSPC due to >> insufficiently provisioned fs size, vs. due to running out of memory in >> a container, both of which return ENOSPC to the process. >> > > Isn't there already a per memcg OOM handler that could be used by > orchestrator to detect the latter? Hi Amir, Thanks for the added context. I'm actually not sure if an OOM handler completely solves the latter case. If shmem_inode_acct_block fails, it happens before the allocation. The OOM won't trigger and we won't know about it, as far as I understand. I'm not sure it's real problem for Google's use case. Khazhy is the expert on their implementation and might be able to better discuss it. I wanna mention that, for the insufficiently-provisioned-fs-size case, we still can't rely just on statfs. We need a polling interface - generic or tmpfs specific - to make sure we don't miss these events, I think. Thanks, -- Gabriel Krisman Bertazi