From: Ting-Yuan Huang <thu...@mozilla.com>
Subject: Re: Bug 850175
Date: Fri, 26 Apr 2013 21:09:50 -0700 (PDT)

> KSM requires those strings to be aligned (to same offsets to page 
> boundaries). It should be fine in this case, but I'm not quite sure.

For jemalloc, it is quite sure for big memory allocation.  For js
string, Greg told me we can use external string object.  I think we
can make sure page alignment at external string object.

> 
> Another characteristic of KSM is that it scans periodically. From the 
> discussion on bugzilla it seems that we are suffering from peak memory usage. 
> I'm afraid that the original, unmodified KSM can't really help. I'll try to 
> find if there are ways in userspace to make duplicated pages COW.

I had looked into the code of KSM.  If I am right, we can mark all big
strings after it was created, and trigger KSM to do scaning and merging
for low-memory warning.  Then, these big string will be merged at the
time, low-memory warning.  Another issue is the number of pages of
scanning is limited.  We should pick a good one.

With following recipe, I guess the big string will be merged in time.
 1. advise big strings after it is created and filled.
 2. perodically trigger scanning by write to /sys/kernel/mm/ksm/run. (opt)
 3. tirgger scanning for low-memory warning.

> 
> ----- Original Message -----
> From: "Thinker K.F. Li" <thin...@codemud.net>
> To: thu...@mozilla.com
> Cc: c...@mozilla.com
> Sent: Saturday, April 27, 2013 1:58:10 AM
> Subject: Re: Bug 850175
> 
> I had told to Greg.  He told me the same string will be duplicated for
> 15 times for inserting to indexedDB.  For indexedDb, it had duplicate
> it for at least 6 times.  I think KSM can play a good game here.
> 
> KSM can play good by advising only big strings or alikes, it play a
> trade-off of overhead and memory.  We can trigger it to start scanning
> and merging for low memory.
> 
> From: Thinker K.F. Li <thin...@eeebox.branda.to>
> Subject: Bug 850175
> Date: Sat, 27 Apr 2013 00:20:22 +0800 (CST)
> 
>> Hi Ting-Yuan,
>> 
>> Tonight, people are talking about bug 850175 on #b2g channel.  There
>> are two issues in that bug, one of issues is twitter will create a big
>> string and send it to indexedDB.  It causes a lot of string
>> duplications in the peak.  Since you are trying the kernel feature of
>> samepage merging, I guess it is a good solution to solve it.  We can
>> give advisement only to big strings to reduce loading of scanning.
>> What do you think?
>> 
>> see https://bugzilla.mozilla.org/show_bug.cgi?id=850175#c74
_______________________________________________
dev-b2g mailing list
dev-b2g@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to