From: Weijie Yang <weijieut@gmail.com>
To: zhiyuan_zhu@htc.com
Cc: mhocko@suse.cz, hannes@cmpxchg.org, Future_Zhou@htc.com,
Rachel_Zhang@htc.com, bsingharora@gmail.com,
kamezawa.hiroyu@jp.fujitsu.com, cgroups@vger.kernel.org,
linux-mm@kvack.org, greg@kroah.com, Sai_Shen@htc.com
Subject: Re: 答复: 答复: low memory killer
Date: Thu, 20 Nov 2014 22:19:05 +0800 [thread overview]
Message-ID: <CABdxLJGViULvRt7nptNzYZN3E7szN3k4BvQAMUrJ7oMBNcoOoQ@mail.gmail.com> (raw)
In-Reply-To: <AF7C0ADF1FEABA4DABABB97411952A2EC91FE0@CN-MBX02.HTC.COM.TW>
[-- Attachment #1: Type: text/plain, Size: 4843 bytes --]
On Thu, Nov 20, 2014 at 8:05 PM, <zhiyuan_zhu@htc.com> wrote:
> Hi Greg/Michal
> Very sorry I have a mistake in previous mail. (It should be nr_file_pages not nr_free_pages)
> I rearrange this problem.
>
> // *********** log begin **********
> 6 161030.084144 2014-11-07 21:44:53.304 lowmemorykiller: Killing 'om.htc.launcher' (4486), adj 294,
> 6 161030.084144 2014-11-07 21:44:53.304 to free 47856kB on behalf of 'kworker/u8:14' (20594) because
> 6 161030.084144 2014-11-07 21:44:53.304 cache 72460kB is below limit 73728kB for oom_score_adj 235
> // **** /proc/meminfo 's result
> 4 161030.084797 2014-11-07 21:44:53.304 Cached: 142448 kB
> // *********** log end **********
>
> After I checked the android's low memory strategy: kernel/drivers/staging/android/lowmemorykiller.c
>
> // ****** code begin *********
> other_file = global_page_state(NR_FILE_PAGES) -
> global_page_state(NR_SHMEM) -
> total_swapcache_pages();
>
> lowmem_print(1, "Killing '%s' (%d), adj %hd,\n" \
> " to free %ldkB on behalf of '%s' (%d) because\n" \
> " cache %ldkB is below limit %ldkB for oom_score_adj %hd\n" \
> " Free memory is %ldkB above reserved\n",
> selected->comm, selected->pid,
> selected_oom_score_adj,
> selected_tasksize * (long)(PAGE_SIZE / 1024),
> current->comm, current->pid,
> other_file * (long)(PAGE_SIZE / 1024),
> minfree * (long)(PAGE_SIZE / 1024),
> min_score_adj,
> other_free * (long)(PAGE_SIZE / 1024));
> // ******* code end ************
>
> So android's strategy's free memory is = other_file = (nr file pages - nr shmem - total swapcache pages) * 4K = [cache 72460kB]
> But the system's free memory is: Cached: 142448 kB // from /proc/meminfo
>
> And system's free memory is: Cached + MemFree + Buffers is largely than the memory which anroid lowmemorykiller calculated memory [cache 72460K]
> At this time point, system will kill some important processes, but system have enough memory.
> This is android's lowmemorykiller defect? or Linux kernel memory's defect?
>
> So I have some questions:
> I have a question: what's the nr file pages mean? What different between nr_file_pages from Cached (from /proc/meminfo)?
> And nr shmem, swapcache pages are small, so I think this is the key problem why android's stragegy calculated free memory is largely less than /proc/meminfo Cached's value.
>
>
Why lowmemkiller -total_swapcache_pages()? see commit 058dbde92:
staging: android: lowmemorykiller: neglect swap cached pages in other_file
With ZRAM enabled it is observed that lowmemory killer
doesn't trigger properly. swap cached pages are
accounted in NR_FILE, and lowmemorykiller considers
this as reclaimable and adds to other_file. But these
pages can't be reclaimed unless lowmemorykiller triggers.
So subtract swap pages from other_file.
and commit 31d59a4198f will also make help, please check it.
> Thanks
> Zhiyuan zhu
>
> -----邮件原件-----
> 发件人: Michal Hocko [mailto:mhocko@suse.cz]
> 发送时间: 2014年11月20日 18:19
> 收件人: Zhiyuan Zhu(朱志遠)
> 抄送: hannes@cmpxchg.org; Future Zhou(周未來); Rachel Zhang(張瑩); bsingharora@gmail.com; kamezawa.hiroyu@jp.fujitsu.com; cgroups@vger.kernel.org; linux-mm@kvack.org; greg@kroah.com
> 主题: Re: 答复: low memory killer
>
> On Thu 20-11-14 10:09:25, zhiyuan_zhu@htc.com wrote:
> > Hi Michal
> > Thanks for your kindly support.
> > I got a device, and dump the /proc/meminfo and /proc/vmstat files,
> > they are the Linux standard proc files.
> > I found that: Cached = 339880 KB, but nr_free_pages=14675*4 = 58700KB
> > and nr_shmem = 508*4=2032KB
> >
> > nr_shmem is just a little memory, and nr free pages + nr_shmem is
> > largely less than Cached. So why nr_free_pages is largely less than
> > Cached? Thank you.
>
> nr_free_pages refers to pages which are not allocated. Cached referes to a used memory which is easily reclaimable so it can be reused should there be a need and free memory drops down. So this is a normal situation. How is this related to the lowmemory killer question posted previously?
>
> [...]
> --
> Michal Hocko
> SUSE Labs
>
>
> CONFIDENTIALITY NOTE : The information in this e-mail is confidential and
> privileged; it is intended for use solely by the individual or entity named
> as the recipient hereof. Disclosure, copying, distribution, or use of the
> contents of this e-mail by persons other than the intended recipient is
> strictly prohibited and may violate applicable laws. If you have received
> this e-mail in error, please delete the original message and notify us by
> return email or collect call immediately. Thank you. HTC Corporation
>
[-- Attachment #2: Type: text/html, Size: 6104 bytes --]
next prev parent reply other threads:[~2014-11-20 14:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-20 9:26 zhiyuan_zhu
2014-11-20 9:58 ` Michal Hocko
2014-11-20 10:09 ` 答复: " zhiyuan_zhu
2014-11-20 10:18 ` Michal Hocko
2014-11-20 12:05 ` 答复: " zhiyuan_zhu
2014-11-20 14:19 ` Weijie Yang [this message]
2014-11-24 16:17 ` Michal Hocko
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=CABdxLJGViULvRt7nptNzYZN3E7szN3k4BvQAMUrJ7oMBNcoOoQ@mail.gmail.com \
--to=weijieut@gmail.com \
--cc=Future_Zhou@htc.com \
--cc=Rachel_Zhang@htc.com \
--cc=Sai_Shen@htc.com \
--cc=bsingharora@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=greg@kroah.com \
--cc=hannes@cmpxchg.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--cc=zhiyuan_zhu@htc.com \
/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