From: Minchan Kim Date: Mon, 6 Aug 2018 06:12:44 +0000 (+0900) Subject: mm: mm_event: add special kernel allocation stat X-Git-Tag: MMI-QSB30.62-17~19 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cee78bb61cdec9886cadf97e9e9ce61e337d83c9;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git mm: mm_event: add special kernel allocation stat Record the count of special page allocation on the process context. This patch aims for accounting of special page allocation which consumed a lot by android system. At this moment, ION system heap is good candidate(it could cover other kernel allocation in future). With that, we could keep tracking burst kernel allocation owner so that it would be useful to find places caused by lmk, reclaim, compaction latency. Mot-CRs-fixed: (CR) Bug: 80168800 Change-Id: I5942fd940d98baa2eb814f66b076cb37ecd3b4aa Signed-off-by: Minchan Kim Reviewed-on: https://gerrit.mot.com/1453724 Tested-by: Jira Key SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c index 311f9d0b38d4..6b2f68e6abf1 100644 --- a/drivers/staging/android/ion/ion_page_pool.c +++ b/drivers/staging/android/ion/ion_page_pool.c @@ -41,6 +41,9 @@ static void *ion_page_pool_alloc_pages(struct ion_page_pool *pool, bool nozero) perrfn("failed to alloc order-0 page (gfp %pGg)", &gfpmask); return NULL; } + + mm_event_count(MM_KERN_ALLOC, 1 << pool->order); + return page; } diff --git a/include/linux/mm_event.h b/include/linux/mm_event.h index 2778fa09c650..81d9a72b11db 100644 --- a/include/linux/mm_event.h +++ b/include/linux/mm_event.h @@ -11,6 +11,7 @@ enum mm_event_type { MM_COMPACTION, MM_RECLAIM, MM_SWP_FAULT, + MM_KERN_ALLOC, MM_TYPE_NUM, }; @@ -26,9 +27,11 @@ struct task_struct; void mm_event_task_init(struct task_struct *tsk); void mm_event_start(ktime_t *time); void mm_event_end(enum mm_event_type event, ktime_t start); +void mm_event_count(enum mm_event_type event, int count); #else static inline void mm_event_task_init(struct task_struct *tsk) {} static inline void mm_event_start(ktime_t *time) {} static inline void mm_event_end(enum mm_event_type event, ktime_t start) {} +static inline void mm_event_count(enum mm_event_type event, int count) {} #endif /* _LINUX_MM_EVENT_H */ #endif diff --git a/include/trace/events/mm_event.h b/include/trace/events/mm_event.h index 34e6d55f0266..7d69e42bc8bd 100644 --- a/include/trace/events/mm_event.h +++ b/include/trace/events/mm_event.h @@ -16,7 +16,8 @@ struct mm_event_task; { MM_MAJ_FAULT, "maj_flt" }, \ { MM_COMPACTION, "compaction" }, \ { MM_RECLAIM, "reclaim" }, \ - { MM_SWP_FAULT, "swp_flt" }) + { MM_SWP_FAULT, "swp_flt" }, \ + { MM_KERN_ALLOC, "kern_alloc" }) TRACE_EVENT(mm_event_record, diff --git a/mm/mm_event.c b/mm/mm_event.c index 5d5c90bbd3b9..af2e28d41b6a 100644 --- a/mm/mm_event.c +++ b/mm/mm_event.c @@ -49,6 +49,12 @@ void mm_event_end(enum mm_event_type event, ktime_t start) record_stat(); } +void mm_event_count(enum mm_event_type event, int count) +{ + current->mm_event[event].count += count; + record_stat(); +} + static struct dentry *mm_event_root; static int period_ms_set(void *data, u64 val)