Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp901884ybe; Fri, 6 Sep 2019 09:00:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzp8aGfnAqiKlgXZTSjmQQlQi2D+7b1/r37F5J8Yc+FL9axinM0tt6N42tvIAyMkwf+dVfP X-Received: by 2002:a63:550d:: with SMTP id j13mr8640763pgb.173.1567785607474; Fri, 06 Sep 2019 09:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567785607; cv=none; d=google.com; s=arc-20160816; b=iD2J/ba1m24EEC4BKDitDpeQP04W1LfFk0qubbol3IvFmO5KsVZjyFgPLTC/icfT0J M7SiNKG6EkHJw0vanp1CCg+ctRVskuHn/4V/iNBS/95CfstG5OeMPYeVBH2JXNJLaXRY U2ay8MbBMJJeTLToGT+jbSRlb6UnPvaPGjY+OD74lRJtxv6SiLNp3Rwqg6YI2/VhCbsD 2f6jBoUsmEmrnMQgi7qMTKkkahbEcMaV5okrTHsy+TkjmRvjzoQuV0QQX0rkVx6xNAAf OAhUZ12j+pBvBDBFtBLIHYK0jVGsJZWtGnlVAuFN5XurLudfPyLtFEgtjPjDG5kqJF3s QaJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Y9V87A5RMYtbo+/8H53ubA8P8RxhCAp72biqBhbO53Y=; b=iW3IUTZ7h9rrkrP88SKibGd4d6i1eQ5sVSJ1uz6qgKjOr+b/o766lfLDYB8jnlvCWx Uk0ckepGp2rwFRmw0CHfw0sZOIIfejnYLpzkshjIe0c/3lAWsvdVfE3OjSTA7/30ivkB ABnWnqX4txvjBqFBdUpLzdfOLZ6ev0b0OUmo56owL29QHICHHtoSI6y/QckBgZ+wsoGs cazy5Aj0YghQG8wBzKuRhsaSVT72sTNyylK4Q3DGvhVDstK3AkWoj9pIoqPxQrmY92qM O0qp4yvjg3Rd2a1hmXB7pSlRwvkHiLAZE8JdK1qjn92MZlBSvv2z3AMjdlOlopcchiRk U2Cg== 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 m17si5702512pfh.93.2019.09.06.08.59.51; Fri, 06 Sep 2019 09:00:07 -0700 (PDT) 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 S2388768AbfIFKq0 (ORCPT + 99 others); Fri, 6 Sep 2019 06:46:26 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:57113 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726080AbfIFKqZ (ORCPT ); Fri, 6 Sep 2019 06:46:25 -0400 Received: from fsav404.sakura.ne.jp (fsav404.sakura.ne.jp [133.242.250.103]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id x86AkCfe050875; Fri, 6 Sep 2019 19:46:12 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav404.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav404.sakura.ne.jp); Fri, 06 Sep 2019 19:46:11 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav404.sakura.ne.jp) Received: from [192.168.1.8] (softbank126227201116.bbtec.net [126.227.201.116]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id x86AkB0Q050870 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NO); Fri, 6 Sep 2019 19:46:11 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [RFC PATCH] mm, oom: disable dump_tasks by default To: Michal Hocko Cc: David Rientjes , linux-mm@kvack.org, Andrew Morton , LKML References: <20190903144512.9374-1-mhocko@kernel.org> <20190904054004.GA3838@dhcp22.suse.cz> <12bcade2-4190-5e5e-35c6-7a04485d74b9@i-love.sakura.ne.jp> <20190905140833.GB3838@dhcp22.suse.cz> From: Tetsuo Handa Message-ID: <20ec856d-0f1e-8903-dbe0-bbc8b7a1847a@i-love.sakura.ne.jp> Date: Fri, 6 Sep 2019 19:46:10 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190905140833.GB3838@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/09/05 23:08, Michal Hocko wrote: > On Thu 05-09-19 22:39:47, Tetsuo Handa wrote: > [...] >> There is nothing that prevents users from enabling oom_dump_tasks by sysctl. >> But that requires a solution for OOM stalling problem. > > You can hardly remove stalling if you are not reducing the amount of > output or get it into a different context. Whether the later is > reasonable is another question but you are essentially losing "at the > OOM event state". > I am not losing "at the OOM event state". Please find "struct oom_task_info" (for now) embedded into "struct task_struct" which holds "at the OOM event state". And my patch moves "printk() from dump_tasks()" from OOM context to WQ context. Thus, I do remove stalling by defer printing of "struct oom_task_info" until the OOM killer sends SIGKILL and the OOM reaper starts reclaiming memory. --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -639,6 +639,21 @@ struct wake_q_node { struct wake_q_node *next; }; +/* Memory usage and misc info as of invocation of OOM killer. */ +struct oom_task_info { + struct list_head list; + unsigned int seq; + char comm[TASK_COMM_LEN]; + pid_t pid; + uid_t uid; + pid_t tgid; + unsigned long total_vm; + unsigned long mm_rss; + unsigned long pgtables_bytes; + unsigned long swapents; + int score_adj; +}; + struct task_struct { #ifdef CONFIG_THREAD_INFO_IN_TASK /* @@ -1260,7 +1275,7 @@ struct task_struct { #ifdef CONFIG_MMU struct task_struct *oom_reaper_list; #endif - struct list_head oom_victim_list; + struct oom_task_info oom_task_info; #ifdef CONFIG_VMAP_STACK struct vm_struct *stack_vm_area; #endif