From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by kanga.kvack.org (Postfix) with ESMTP id 833B16B0253 for ; Mon, 12 Oct 2015 10:44:23 -0400 (EDT) Received: by pabve7 with SMTP id ve7so98052491pab.2 for ; Mon, 12 Oct 2015 07:44:23 -0700 (PDT) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTPS id hi3si26557296pbb.94.2015.10.12.07.44.22 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 12 Oct 2015 07:44:22 -0700 (PDT) Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NW400ZMM3LWEU60@mailout2.samsung.com> for linux-mm@kvack.org; Mon, 12 Oct 2015 23:44:21 +0900 (KST) From: PINTU KUMAR References: <1443696523-27262-1-git-send-email-pintu.k@samsung.com> <1444656800-29915-1-git-send-email-pintu.k@samsung.com> In-reply-to: <1444656800-29915-1-git-send-email-pintu.k@samsung.com> Subject: RE: [PATCH 1/1] mm: vmstat: Add OOM victims count in vmstat counter Date: Mon, 12 Oct 2015 20:14:21 +0530 Message-id: <057801d104fc$9dafaa20$d90efe60$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit Content-language: en-us Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org, minchan@kernel.org, dave@stgolabs.net, mhocko@suse.cz, koct9i@gmail.com, rientjes@google.com, hannes@cmpxchg.org, penguin-kernel@i-love.sakura.ne.jp, bywxiaobai@163.com, mgorman@suse.de, vbabka@suse.cz, js1304@gmail.com, kirill.shutemov@linux.intel.com, alexander.h.duyck@redhat.com, sasha.levin@oracle.com, cl@linux.com, fengguang.wu@intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: cpgs@samsung.com, pintu_agarwal@yahoo.com, pintu.ping@gmail.com, vishnu.ps@samsung.com, rohit.kr@samsung.com, c.rajkumar@samsung.com, sreenathd@samsung.com Hi, Sorry, I forgot to mention the V2 update. I will highlight the V2 changes and RESEND. > -----Original Message----- > From: Pintu Kumar [mailto:pintu.k@samsung.com] > Sent: Monday, October 12, 2015 7:03 PM > To: akpm@linux-foundation.org; minchan@kernel.org; dave@stgolabs.net; > pintu.k@samsung.com; mhocko@suse.cz; koct9i@gmail.com; > rientjes@google.com; hannes@cmpxchg.org; penguin-kernel@i- > love.sakura.ne.jp; bywxiaobai@163.com; mgorman@suse.de; vbabka@suse.cz; > js1304@gmail.com; kirill.shutemov@linux.intel.com; > alexander.h.duyck@redhat.com; sasha.levin@oracle.com; cl@linux.com; > fengguang.wu@intel.com; linux-kernel@vger.kernel.org; linux-mm@kvack.org > Cc: cpgs@samsung.com; pintu_agarwal@yahoo.com; pintu.ping@gmail.com; > vishnu.ps@samsung.com; rohit.kr@samsung.com; c.rajkumar@samsung.com; > sreenathd@samsung.com > Subject: [PATCH 1/1] mm: vmstat: Add OOM victims count in vmstat counter > > This patch maintains the number of oom victims kill count in /proc/vmstat. > Currently, we are dependent upon kernel logs when the kernel OOM occurs. > But kernel OOM can went passed unnoticed by the developer as it can silently > kill some background applications/services. > In some small embedded system, it might be possible that OOM is captured in > the logs but it was over-written due to ring-buffer. > Thus this interface can quickly help the user in analyzing, whether there were > any OOM kill happened in the past, or whether the system have ever entered > the oom kill stage till date. > > Thus, it can be beneficial under following cases: > 1. User can monitor kernel oom kill scenario without looking into the > kernel logs. > 2. It can help in tuning the watermark level in the system. > 3. It can help in tuning the low memory killer behavior in user space. > 4. It can be helpful on a logless system or if klogd logging > (/var/log/messages) are disabled. > > A snapshot of the result of 3 days of over night test is shown below: > System: ARM Cortex A7, 1GB RAM, 8GB EMMC > Linux: 3.10.xx > Category: reference smart phone device > Loglevel: 7 > Conditions: Fully loaded, BT/WiFi/GPS ON > Tests: auto launching of ~30+ apps using test scripts, in a loop for > 3 days. > At the end of tests, check: > $ cat /proc/vmstat > nr_oom_victims 6 > > As we noticed, there were around 6 oom kill victims. > > The OOM is bad for any system. So, this counter can help in quickly tuning the > OOM behavior of the system, without depending on the logs. > > Signed-off-by: Pintu Kumar > --- > include/linux/vm_event_item.h | 1 + > mm/oom_kill.c | 2 ++ > mm/page_alloc.c | 1 - > mm/vmstat.c | 1 + > 4 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h > index 2b1cef8..dd2600d 100644 > --- a/include/linux/vm_event_item.h > +++ b/include/linux/vm_event_item.h > @@ -57,6 +57,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, > PSWPOUT, #ifdef CONFIG_HUGETLB_PAGE > HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, #endif > + NR_OOM_VICTIMS, > UNEVICTABLE_PGCULLED, /* culled to noreclaim list */ > UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */ > UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */ > diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 03b612b..802b8a1 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -570,6 +570,7 @@ void oom_kill_process(struct oom_control *oc, struct > task_struct *p, > * space under its control. > */ > do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, true); > + count_vm_event(NR_OOM_VICTIMS); > mark_oom_victim(victim); > pr_err("Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file- > rss:%lukB\n", > task_pid_nr(victim), victim->comm, K(victim->mm->total_vm), > @@ -600,6 +601,7 @@ void oom_kill_process(struct oom_control *oc, struct > task_struct *p, > task_pid_nr(p), p->comm); > task_unlock(p); > do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, true); > + count_vm_event(NR_OOM_VICTIMS); > } > rcu_read_unlock(); > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9bcfd70..fafb09d 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -2761,7 +2761,6 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned > int order, > schedule_timeout_uninterruptible(1); > return NULL; > } > - > /* > * Go through the zonelist yet one more time, keep very high watermark > * here, this is only to catch a parallel oom killing, we must fail if diff --git > a/mm/vmstat.c b/mm/vmstat.c index 1fd0886..8503a2e 100644 > --- a/mm/vmstat.c > +++ b/mm/vmstat.c > @@ -808,6 +808,7 @@ const char * const vmstat_text[] = { > "htlb_buddy_alloc_success", > "htlb_buddy_alloc_fail", > #endif > + "nr_oom_victims", > "unevictable_pgs_culled", > "unevictable_pgs_scanned", > "unevictable_pgs_rescued", > -- > 1.7.9.5 Regards, Pintu -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751857AbbJLOoZ (ORCPT ); Mon, 12 Oct 2015 10:44:25 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:37613 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751583AbbJLOoW (ORCPT ); Mon, 12 Oct 2015 10:44:22 -0400 X-AuditID: cbfee691-f79d66d000001509-d9-561bc7448794 From: PINTU KUMAR To: akpm@linux-foundation.org, minchan@kernel.org, dave@stgolabs.net, mhocko@suse.cz, koct9i@gmail.com, rientjes@google.com, hannes@cmpxchg.org, penguin-kernel@i-love.sakura.ne.jp, bywxiaobai@163.com, mgorman@suse.de, vbabka@suse.cz, js1304@gmail.com, kirill.shutemov@linux.intel.com, alexander.h.duyck@redhat.com, sasha.levin@oracle.com, cl@linux.com, fengguang.wu@intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: cpgs@samsung.com, pintu_agarwal@yahoo.com, pintu.ping@gmail.com, vishnu.ps@samsung.com, rohit.kr@samsung.com, c.rajkumar@samsung.com, sreenathd@samsung.com References: <1443696523-27262-1-git-send-email-pintu.k@samsung.com> <1444656800-29915-1-git-send-email-pintu.k@samsung.com> In-reply-to: <1444656800-29915-1-git-send-email-pintu.k@samsung.com> Subject: RE: [PATCH 1/1] mm: vmstat: Add OOM victims count in vmstat counter Date: Mon, 12 Oct 2015 20:14:21 +0530 Message-id: <057801d104fc$9dafaa20$d90efe60$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AQHFyC/Uoy22OwXqBhG9QnqJ8jAPkwJMXYG3nmwFWLA= Content-language: en-us X-Brightmail-Tracker: H4sIAAAAAAAAA02Sa0iTURjHO3uvG0mn5eU4C2VklpXlrU4Xog9+eCGDIvBDBLbsxaQ5xy5S QWpZhl0knVlODWtdbM6saaKVNpdd1AS7oXO6tIumpnah6aws5wz89nvO+fH8nwcelhDbKAmb pNDwKoVMLqVFpMk76ujqmGcBcWsdTzAurjTR+PfURRLnFIfgM/k6Ae5wfgF40LoCl9tMAI8N VBK43LwdF9aXUNg2UEziW9m9FH59v5jGDtNfCutG+wEeyhyn8I2fYwwuOjFK4Y7BAhI7R+wM zrp2V4AHMk+S2NBkJ/CZD5kkLjqWA3B+Tg/YKuEMZfkU9/jLGMHV6XsYrtSs5eoqjALO8HBQ wJmN2TRn/p7HcM8v/SK5j28uCrjLzTu5b5+6SG6s4S3N5VQbAXehKJ17UdrE7Fi0W7R5Py9P SuVVa7bsFR14353NKG0hh2qMHVQGyA06DYQsglGovvY34WFf1O6opE8DESuGZQD96bwq+C/V Gisoz4ceoFt32matEYC+vbRMFyxLwxD01OLlfveGVQSaOGlh3AUBDQCdchUw7lZieBQdzzxL u1kIY1Br/RPSzYtgLLo91DUzBwmD0atnD2bYC25Afa4B4OGFaELnmPEJGIqqao5THg5EVaaR 2R2CU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GKzCKhKXDq+ G8zmFbCUePjzOSOELSjxY/I9sHpmAS2JzduaWCFseYnNa94yQ5yqILHj7GuwehEBK4nF/36x Q9SIS0x68JB9AqPQLCSjZiEZNQvJqFlIWhYwsqxilEgtSC4oTkrPNcpLLdcrTswtLs1L10vO z93ECE6kz6R3MB7e5X6IUYCDUYmHl2OLVJgQa2JZcWXuIUYJDmYlEV6lidJhQrwpiZVVqUX5 8UWlOanFhxhNgZ6dyCwlmpwPTPJ5JfGGxibmpsamliYWJmaWSuK8Nw4xhAkJpCeWpGanphak FsH0MXFwSjUwFjWWClzZZty/Nne5MveJ6uNVRr13FntWGV75dOaMR99Grw3Ryarf8rfKp1V5 TpRx57+243q76KW9N0SyjuVcb0l/G/l/7//jffniqztWlETs85/zydS9PGypZP1kFecb5YGn mb4fXPhjRiLDeuHbhclrxd26F63rPaXOnL2OS1Xl3NrL7rETlViKMxINtZiLihMBmaipRLoD AAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Sorry, I forgot to mention the V2 update. I will highlight the V2 changes and RESEND. > -----Original Message----- > From: Pintu Kumar [mailto:pintu.k@samsung.com] > Sent: Monday, October 12, 2015 7:03 PM > To: akpm@linux-foundation.org; minchan@kernel.org; dave@stgolabs.net; > pintu.k@samsung.com; mhocko@suse.cz; koct9i@gmail.com; > rientjes@google.com; hannes@cmpxchg.org; penguin-kernel@i- > love.sakura.ne.jp; bywxiaobai@163.com; mgorman@suse.de; vbabka@suse.cz; > js1304@gmail.com; kirill.shutemov@linux.intel.com; > alexander.h.duyck@redhat.com; sasha.levin@oracle.com; cl@linux.com; > fengguang.wu@intel.com; linux-kernel@vger.kernel.org; linux-mm@kvack.org > Cc: cpgs@samsung.com; pintu_agarwal@yahoo.com; pintu.ping@gmail.com; > vishnu.ps@samsung.com; rohit.kr@samsung.com; c.rajkumar@samsung.com; > sreenathd@samsung.com > Subject: [PATCH 1/1] mm: vmstat: Add OOM victims count in vmstat counter > > This patch maintains the number of oom victims kill count in /proc/vmstat. > Currently, we are dependent upon kernel logs when the kernel OOM occurs. > But kernel OOM can went passed unnoticed by the developer as it can silently > kill some background applications/services. > In some small embedded system, it might be possible that OOM is captured in > the logs but it was over-written due to ring-buffer. > Thus this interface can quickly help the user in analyzing, whether there were > any OOM kill happened in the past, or whether the system have ever entered > the oom kill stage till date. > > Thus, it can be beneficial under following cases: > 1. User can monitor kernel oom kill scenario without looking into the > kernel logs. > 2. It can help in tuning the watermark level in the system. > 3. It can help in tuning the low memory killer behavior in user space. > 4. It can be helpful on a logless system or if klogd logging > (/var/log/messages) are disabled. > > A snapshot of the result of 3 days of over night test is shown below: > System: ARM Cortex A7, 1GB RAM, 8GB EMMC > Linux: 3.10.xx > Category: reference smart phone device > Loglevel: 7 > Conditions: Fully loaded, BT/WiFi/GPS ON > Tests: auto launching of ~30+ apps using test scripts, in a loop for > 3 days. > At the end of tests, check: > $ cat /proc/vmstat > nr_oom_victims 6 > > As we noticed, there were around 6 oom kill victims. > > The OOM is bad for any system. So, this counter can help in quickly tuning the > OOM behavior of the system, without depending on the logs. > > Signed-off-by: Pintu Kumar > --- > include/linux/vm_event_item.h | 1 + > mm/oom_kill.c | 2 ++ > mm/page_alloc.c | 1 - > mm/vmstat.c | 1 + > 4 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h > index 2b1cef8..dd2600d 100644 > --- a/include/linux/vm_event_item.h > +++ b/include/linux/vm_event_item.h > @@ -57,6 +57,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, > PSWPOUT, #ifdef CONFIG_HUGETLB_PAGE > HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, #endif > + NR_OOM_VICTIMS, > UNEVICTABLE_PGCULLED, /* culled to noreclaim list */ > UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */ > UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */ > diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 03b612b..802b8a1 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -570,6 +570,7 @@ void oom_kill_process(struct oom_control *oc, struct > task_struct *p, > * space under its control. > */ > do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, true); > + count_vm_event(NR_OOM_VICTIMS); > mark_oom_victim(victim); > pr_err("Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file- > rss:%lukB\n", > task_pid_nr(victim), victim->comm, K(victim->mm->total_vm), > @@ -600,6 +601,7 @@ void oom_kill_process(struct oom_control *oc, struct > task_struct *p, > task_pid_nr(p), p->comm); > task_unlock(p); > do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, true); > + count_vm_event(NR_OOM_VICTIMS); > } > rcu_read_unlock(); > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9bcfd70..fafb09d 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -2761,7 +2761,6 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned > int order, > schedule_timeout_uninterruptible(1); > return NULL; > } > - > /* > * Go through the zonelist yet one more time, keep very high watermark > * here, this is only to catch a parallel oom killing, we must fail if diff --git > a/mm/vmstat.c b/mm/vmstat.c index 1fd0886..8503a2e 100644 > --- a/mm/vmstat.c > +++ b/mm/vmstat.c > @@ -808,6 +808,7 @@ const char * const vmstat_text[] = { > "htlb_buddy_alloc_success", > "htlb_buddy_alloc_fail", > #endif > + "nr_oom_victims", > "unevictable_pgs_culled", > "unevictable_pgs_scanned", > "unevictable_pgs_rescued", > -- > 1.7.9.5 Regards, Pintu