From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Ebru Akagunduz <ebru.akagunduz@gmail.com>
Cc: linux-mm@kvack.org, hughd@google.com, riel@redhat.com,
akpm@linux-foundation.org, kirill.shutemov@linux.intel.com,
n-horiguchi@ah.jp.nec.com, aarcange@redhat.com,
iamjoonsoo.kim@lge.com, gorcunov@openvz.org,
linux-kernel@vger.kernel.org, mgorman@suse.de,
rientjes@google.com, vbabka@suse.cz,
aneesh.kumar@linux.vnet.ibm.com, hannes@cmpxchg.org,
mhocko@suse.cz, boaz@plexistor.com
Subject: Re: [PATCH v2 1/2] mm, vmstat: calculate particular vm event
Date: Mon, 14 Mar 2016 02:08:06 +0300 [thread overview]
Message-ID: <20160313230806.GA10438@node.shutemov.name> (raw)
In-Reply-To: <1457861335-23297-2-git-send-email-ebru.akagunduz@gmail.com>
On Sun, Mar 13, 2016 at 11:28:54AM +0200, Ebru Akagunduz wrote:
> Currently, vmstat can calculate specific vm event with all_vm_events()
> however it allocates all vm events to stack. This patch introduces
> a helper to sum value of a specific vm event over all cpu, without
> loading all the events.
>
> Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
> ---
> Changes in v2:
> - this patch newly created in this version
> - create sum event function to
> calculate particular vm event (Kirill A. Shutemov)
>
> include/linux/vmstat.h | 2 ++
> mm/vmstat.c | 12 ++++++++++++
> 2 files changed, 14 insertions(+)
>
> diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
> index 73fae8c..add0cc1 100644
> --- a/include/linux/vmstat.h
> +++ b/include/linux/vmstat.h
> @@ -53,6 +53,8 @@ static inline void count_vm_events(enum vm_event_item item, long delta)
>
> extern void all_vm_events(unsigned long *);
>
> +extern unsigned long sum_vm_event(enum vm_event_item item);
> +
> extern void vm_events_fold_cpu(int cpu);
>
> #else
You need dumy definition of the function for !CONFIG_VM_EVENT_COUNTERS
case here. Otherwise build will fail. See 0-day report.
Otherwise looks good to me:
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index 5e43004..b76d664 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -34,6 +34,18 @@
> DEFINE_PER_CPU(struct vm_event_state, vm_event_states) = {{0}};
> EXPORT_PER_CPU_SYMBOL(vm_event_states);
>
> +unsigned long sum_vm_event(enum vm_event_item item)
> +{
> + int cpu;
> + unsigned long ret = 0;
> +
> + get_online_cpus();
> + for_each_online_cpu(cpu)
> + ret += per_cpu(vm_event_states, cpu).event[item];
> + put_online_cpus();
> + return ret;
> +}
> +
> static void sum_vm_events(unsigned long *ret)
> {
> int cpu;
> --
> 1.9.1
>
> --
> 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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
Kirill A. Shutemov
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-03-13 23:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-13 9:28 [PATCH v2 0/2] mm, thp: Fix unnecessarry resource consuming in swapin Ebru Akagunduz
2016-03-13 9:28 ` [PATCH v2 1/2] mm, vmstat: calculate particular vm event Ebru Akagunduz
2016-03-13 23:08 ` Kirill A. Shutemov [this message]
2016-03-13 9:28 ` [PATCH v2 2/2] mm, thp: avoid unnecessary swapin in khugepaged Ebru Akagunduz
2016-03-13 9:45 ` kbuild test robot
2016-03-13 23:33 ` Kirill A. Shutemov
2016-03-14 1:14 ` Rik van Riel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160313230806.GA10438@node.shutemov.name \
--to=kirill@shutemov.name \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=boaz@plexistor.com \
--cc=ebru.akagunduz@gmail.com \
--cc=gorcunov@openvz.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=riel@redhat.com \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).