Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2762996pxb; Mon, 25 Apr 2022 01:42:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyju8LraEvatlUmATOdBAybuiBntbzBlynlOo0JkCE8a7+rv58uzmKmlx0fgUo9sTmordVl X-Received: by 2002:a63:b58:0:b0:399:522b:d92f with SMTP id a24-20020a630b58000000b00399522bd92fmr14177962pgl.141.1650876143907; Mon, 25 Apr 2022 01:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650876143; cv=none; d=google.com; s=arc-20160816; b=PyaKpRuCTZiyLoU4gAY6DLfPqFtgBbPInc1syxQnpQoXnDvIGbUFtNRv7986LI9HBf UISTPxlJFAgtG2DhAz34iIq0MQjJr52+MyPaWxMiFdoZdt+2SXgysSGENsbAnkviav3L wE7IjB8QfaTT8JOUQ/u4HSl1F+R09OAd4QXNlJjFMzF5tFuYbGqBy4lPBl4u/09Kqbjw c15F92WOHlytw2x5ZPAY4UgQkzOVUf2sHwOTeASg7i5NIAwnBZUyuvZAecyk/qMaUWp7 A+rO04TZq56vpAMSm0afVhoqxC/7Gr9x2txX3pkQSvJbZNC0agxOs4Wru5dLMb6xnj84 KdIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=7eEKnLIXj5zsgTQ7iNi5dQLveAyt5ZLnNOvfCtqzQoE=; b=HePD1JWka0Ice50DGyYtFPvV+BULkylQ1nCWyOYby04CN0OPrtMFKEgEVvkLNf1kEF WlY+LiOYOzSgQBwjfzgajeBBt+8Xy1wIYLH1JbSkvuLmPjPorRLpJLXlOAg8mKy4dxIX Fx2ZIUitl20LI0w8K8mibWFo6vuOWjeYX6su9TxVjGmMzyMgsMxRG4saSPiGuC10ouyf jfqy9BRDGTvxMMMDax1HuFEuRu7XD/BzPUoARrX7Dlpn/zW/b7GppmvowpS3+iRAPO7W g70CeqdDseSuzfBgD8TFrqU0x83K5GGHvV4wndgCAal7Nf66S5TrHnLAl4GKiekZZ0iJ gY2A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s77-20020a632c50000000b0039db795524csi16198443pgs.42.2022.04.25.01.42.09; Mon, 25 Apr 2022 01:42:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235326AbiDWLvb (ORCPT + 99 others); Sat, 23 Apr 2022 07:51:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235120AbiDWLv3 (ORCPT ); Sat, 23 Apr 2022 07:51:29 -0400 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 571A81F3130 for ; Sat, 23 Apr 2022 04:48:32 -0700 (PDT) Received: from fsav112.sakura.ne.jp (fsav112.sakura.ne.jp [27.133.134.239]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 23NBmTfj015009; Sat, 23 Apr 2022 20:48:29 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav112.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav112.sakura.ne.jp); Sat, 23 Apr 2022 20:48:29 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav112.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 23NBmSiS015000 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Sat, 23 Apr 2022 20:48:28 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <8a6659ba-13ba-b9be-08c8-f02f106d55fb@I-love.SAKURA.ne.jp> Date: Sat, 23 Apr 2022 20:48:28 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v2 8/8] mm: Centralize & improve oom reporting in show_mem.c Content-Language: en-US To: Kent Overstreet Cc: Michal Hocko , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, hch@lst.de, hannes@cmpxchg.org, akpm@linux-foundation.org, linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, linux-input@vger.kernel.org, rostedt@goodmis.org, Roman Gushchin References: <20220421234837.3629927-1-kent.overstreet@gmail.com> <20220421234837.3629927-14-kent.overstreet@gmail.com> <20220422234820.plusgyixgybebfmi@moria.home.lan> <20220423004607.q4lbz2mplkhlbyhm@moria.home.lan> From: Tetsuo Handa In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_NONE 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 2022/04/23 10:25, Roman Gushchin wrote: >>> I agree. However the OOM killer _has_ to make the progress even in such rare >>> circumstances. >> >> Oh, and the concern is allocator recursion? Yeah, that's a good point. > > Yes, but not the only problem. > >> >> Do you know if using memalloc_noreclaim_(save|restore) is sufficient for that, >> or do we want GFP_ATOMIC? I'm already using GFP_ATOMIC for allocations when we >> generate the report on slabs, since we're taking the slab mutex there. > > And this is another problem: grabbing _any_ locks from the oom context is asking > for trouble: you can potentially enter the oom path doing any allocation, so > now you have to check that no allocations are ever made holding this lock. > And I'm not aware of any reasonable way to test it, so most likely it ends up > introducing some very subtle bags, which will be triggered once a year. > You can't allocate memory nor hold locks from OOM context. Since oom_lock mutex serializes OOM reporting, you could use statically pre-allocated buffer for holding one line of output. Correlating whole report will be done by the userspace program with the aid of CONFIG_PRINTK_CALLER=y.