lkml.org 
[lkml]   [2016]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 06/13] fork: Add generic vmalloced stack support
On Fri, Jun 17, 2016 at 1:57 PM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> On Fri, Jun 17, 2016 at 01:00:42PM -0700, Andy Lutomirski wrote:
>> @@ -213,24 +232,46 @@ struct kmem_cache *vm_area_cachep;
>> /* SLAB cache for mm_struct structures (tsk->mm) */
>> static struct kmem_cache *mm_cachep;
>>
>> -static void account_kernel_stack(struct thread_info *ti, int account)
>> +static void account_kernel_stack(struct task_struct *tsk, int account)
>> {
>> - struct zone *zone = page_zone(virt_to_page(ti));
>> + struct zone *zone;
>> + struct thread_info *ti = task_thread_info(tsk);
>> + struct vm_struct *vm = task_stack_vm_area(tsk);
>> +
>> + BUILD_BUG_ON(IS_ENABLED(CONFIG_VMAP_STACK) && PAGE_SIZE % 1024 != 0);
>> +
>> + if (vm) {
>> + int i;
>>
>> - mod_zone_page_state(zone, NR_KERNEL_STACK_KB,
>> - THREAD_SIZE / 1024 * account);
>> + BUG_ON(vm->nr_pages != THREAD_SIZE / PAGE_SIZE);
>>
>> - /* All stack pages belong to the same memcg. */
>> - memcg_kmem_update_page_stat(
>> - virt_to_page(ti), MEMCG_KERNEL_STACK,
>> - account * (THREAD_SIZE / PAGE_SIZE));
>> + for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++) {
>> + mod_zone_page_state(page_zone(vm->pages[i]),
>> + 1, PAGE_SIZE / 1024 * account);
>
> Shouldn't the second argument be NR_KERNEL_STACK_KB instead of 1?

Indeed. Queued for v3.

--Andy

\
 
 \ /
  Last update: 2016-06-18 01:01    [W:0.085 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site