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 2BDE1C77B60 for ; Wed, 26 Apr 2023 05:10:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48A376B0071; Wed, 26 Apr 2023 01:10:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 439C36B0072; Wed, 26 Apr 2023 01:10:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 328CA6B0074; Wed, 26 Apr 2023 01:10:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 22A1F6B0071 for ; Wed, 26 Apr 2023 01:10:44 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E6D8F14013B for ; Wed, 26 Apr 2023 05:10:43 +0000 (UTC) X-FDA: 80722367166.02.7663ED1 Received: from smtp-relay-canonical-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) by imf24.hostedemail.com (Postfix) with ESMTP id 2F164180010 for ; Wed, 26 Apr 2023 05:10:41 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=canonical.com header.s=20210705 header.b=D4IfGVBT; spf=pass (imf24.hostedemail.com: domain of hui.wang@canonical.com designates 185.125.188.121 as permitted sender) smtp.mailfrom=hui.wang@canonical.com; dmarc=pass (policy=none) header.from=canonical.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682485842; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=152qi21On8X861edn+QHUHcOR+6bIRvJpaLM2Y3yzdQ=; b=JbbHfmpWryW15Nv4IG98a945vEhBmmRPwvDVg4ZOBwtTP/C/LIU666c+Shi5DY5BvofgD0 mfQjTzUe64arY1MB7oAMZKm//xXuQ6fW3CfGba8bIOsRfkIMdJ/Kqsv4uk7kKhYzlg2V/X J6tmPrqQbZPqPxltLYWBlIyNw6bsxzE= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=canonical.com header.s=20210705 header.b=D4IfGVBT; spf=pass (imf24.hostedemail.com: domain of hui.wang@canonical.com designates 185.125.188.121 as permitted sender) smtp.mailfrom=hui.wang@canonical.com; dmarc=pass (policy=none) header.from=canonical.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682485842; a=rsa-sha256; cv=none; b=dl4VkQRnd39W1wToeu/kV6kk/lXC4I72E64WxqOXlC5Org5Ym4CexH0MndsX6mIFfW+D0h 9C66LVR9H4BMXGk/sOaOtKkyTrNFA6QDOc7DQvXy/CL0IT4eM4PsfLgBf/yZJ/6TQ2yyuT bC86N5TSadUb0FrlX2JYTp/LTXEbvN8= Received: from localhost.localdomain (unknown [123.112.66.36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id C0BC13FC2B; Wed, 26 Apr 2023 05:10:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1682485839; bh=152qi21On8X861edn+QHUHcOR+6bIRvJpaLM2Y3yzdQ=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=D4IfGVBTCRrLLLnHybFR96VORxoqG99rXeb/ACVT3/uJgvg1m0JzlHxQZMorP/I1C ax4j2whgxT7OthLwaQWKA1O0DateUOAQBPjU8F8L6sKYwQRxUI76++ms/yNKKu0uZ7 4GeitDP7W+KyB3cweetiNDP6ViviTkT6J5oG0UZhUqkiyQyOEjnsPp7Gtcg2lKMjm1 mzfnxp7sATlTN0+0zWyVHG9tHJgqt9i3IG1ky7JA9QEvKg1mTM9dR8qPmauYNiuh5r FyXVdL/qLK7sbFH+ginP2410QC3W/EfpY0apTZ6iVCmxZo4KpcNN7Homii/9xQkamG K19fT6isOvtmw== From: Hui Wang To: linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@suse.com Cc: surenb@google.com, colin.i.king@gmail.com, shy828301@gmail.com, hannes@cmpxchg.org, vbabka@suse.cz, hch@infradead.org, mgorman@suse.de, dan.carpenter@oracle.com, hui.wang@canonical.com Subject: [PATCH 0/1] mm/oom_kill: system enters a state something like hang when running stress-ng Date: Wed, 26 Apr 2023 13:10:29 +0800 Message-Id: <20230426051030.112007-1-hui.wang@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: mzy9adwb5zx1euq1biiaxbph64fppiq5 X-Rspam-User: X-Rspamd-Queue-Id: 2F164180010 X-Rspamd-Server: rspam06 X-HE-Tag: 1682485841-249768 X-HE-Meta: U2FsdGVkX18QaGOgA3ksi2bSL7238ywn9JXODmegi2bX9UBFnEAvzx++RqiYmzoRHwHHj0AbjK+6TZu05rAWmGk5p5SeqPgJF0yIebzNu/00MYKQGeEh2EltFCPcnMZwTPQwHc77tiZei7X6Uu/zU7z1I4GVUTIG9UQMQH2seIHb6Z2h6qW+Mq4SdTU9NTtAFFYauWkOVkrg51VwehzcLF+EA5qxDAQZphm7lJDgo54QLdkzl7FT5GWeYgjxXdoaFyQNjayD0IlYx4tjkrUyarhWHpaCi/+51MZlqkmerRxsoGR6Wud6REIWKor6Ox0FX0O5d9ktbljzRVvimR1saKS+FG91qrT4/sirIVOeFnpQP6QNTO8BNbKxKNXimidvx6QIF3Kye2dV2htX3dfyGKY/bpNdqNtciToG6lR4kUZX2KC6ncPoPhSnsrq/vVXbyVC3mecZuKV+MeIG242g5xZsI1VvJRVUt1B6QuXHN+SeAnee8UPA4IFe+c1QveFHlx2fvWY+9Y7SNZzV1gZc4ZVWceoLOz7cxnjGD9A3gWf6zqSHCbRNvGI2LkmRmazBt/S9ZIppLbropnQxa/2gpWg9RYrbjtqQlkZZ14mEzB0oV59h8Zb4AECbYUxdMvAnjcLaYRjejutBLb9DG6OmZSBxpMghSv2UtFCZpDg104BX6/+muagpxT+vIiG5nHwumuhaKvVTKVAd1MxFQ6wVW+0MDbQulOKMwhmVHYvaxU/nCfugjYDgfwOJIqG62TLyAPK/O5RDNBzgrjaR7W1XIP84aGSbySf5z3a9Ghpa8yFXymxTXu17kq0qa9WH76TalX4lht/X3RPn7BSpYV4XbN8JeJZU8qRiQg7G7PTYdsquVCRfVV77nC3uVh3TFirus+iVcF+kgfIgV677nx5C5IORAcZ72604fZTOL06UqOpb8X5LXZOhbj8I5y0wu+BA31WmpL1qdpdmcr2DLGU NPdRJYLw ii1w5nSXhNjXJ8vz2++m9AJDejpfStEWf1uFRMtsWG5bkFgF3Y9UAL1rO/eNpY81d5yjavRHquu/N48gPiKkEX+dVz4qAAt+2VaSZcFCqKl4MZ+yM1rJiyY900WDTDWk/0CoiJNVQ2J5x8Vc82VNQq79h+gXefvwlmKJSqe42d2g0uhSMSVDrL1ttwPtsqtvYJgzm0hvg9yvN2DcwQJZIOBdIVe6GvscGHmFYrta9axrDU7k6G0rMWfLCztlKpFpHQ6nkDDh1dFHI3x3ohAusaisR+X7DfYw1fJIRLb0xUtVN+zllK/L/b5ANnJ8Jre7aaiNEOI/qFImDPV8= 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: When we run stress-ng on the UC (Ubuntu Core), the system will be in a state similar to hang. And we found if a testcase could introduce the oom (like stress-ng-bigheap, stress-ng-brk, ...) under the UC, it is highly possible that this testcase will make the system be in a state like hang. We had a discussion for this issue here: https://github.com/ColinIanKing/stress-ng/pull/270 The root cause are Ubuntu Core is constructed on squashfs, and out_of_memory() will not trigger the oom killer for an allocation without __GFP_FS. For squashfs side: memalloc_nofs_save() squashfs_readahead()--->...--->alloc_page() /* alloc without __GFP_FS */ memalloc_nofs_restore() For oom side: out_of_memory() if (oc->gfp_mask && !(oc->gfp_mask & __GFP_FS) && !is_memcg_oom(oc)) return true; In the out_of_memory(), this design exists for a long period of time, If removing these 2 lines, the issue could be fixed. But I don't know if it is allowed to do so or not. From my understanding, there will be no problem to remove those 2 lines, since if the allocation without __GFP_FS triggers the oom killer, the killer will select a process to kill, it has no difference with an allocation with __GFP_FS. Since this design exists for a long time, it is risky to change it, here I use a kthread to trigger oom with __GFP_FS when needed, I think it is a safer way to resolve this issue. Please help review it. Thanks. Hui Wang (1): mm/oom_kill: trigger the oom killer if oom occurs without __GFP_FS mm/oom_kill.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) -- 2.34.1