Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753849AbaBYSpy (ORCPT ); Tue, 25 Feb 2014 13:45:54 -0500 Received: from mail-ve0-f170.google.com ([209.85.128.170]:62033 "EHLO mail-ve0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753609AbaBYSpx (ORCPT ); Tue, 25 Feb 2014 13:45:53 -0500 MIME-Version: 1.0 In-Reply-To: References: <1393352206.2577.36.camel@buesod1.americas.hpqcorp.net> Date: Tue, 25 Feb 2014 10:45:51 -0800 X-Google-Sender-Auth: x8gl9whW0k7NTHOHk1wUHsFE6c0 Message-ID: Subject: Re: [PATCH v2] mm: per-thread vma caching From: Linus Torvalds To: Davidlohr Bueso Cc: Andrew Morton , Ingo Molnar , Peter Zijlstra , Michel Lespinasse , Mel Gorman , Rik van Riel , KOSAKI Motohiro , "Chandramouleeswaran, Aswin" , "Norton, Scott J" , linux-mm , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 25, 2014 at 10:37 AM, Linus Torvalds wrote: > > - clear all the cache entries (of the new 'struct task_struct'! - so > not in dup_mmap, but make sure it's zeroed when allocating!)( > > - set vmcache_seqnum to 0 in dup_mmap (since any sequence number is > fine when it got invalidated, and 0 is best for "avoid overflow"). Btw, as far as I can tell, that also makes the per-thread vmacache automatically do the right thing for the non-MMU case, so that you could just remove the difference between CONFIG_MMU and NOMMU. Basically, dup_mmap() should no longer have anything to do with the vmacache, since it is now per-thread, not per-mm. So : - allocating a new "struct mm_struct" should clear the vmacache_seqnum for that new mm, to try to minimize unnecessary future overflow. - thread allocation should just zero the cache entries, and set "tsk->vmacache_seqnum = mm->vmacache_seqnum" (after dup_mm()) to avoid future unnecessary flushes. and as far as I can tell, the logic would be exactly the same on NOMMU (the dup_mm just doesn't happen, since all forks are basically sharing mm). And maybe you'd want to make VMACACHE_SIZE be 1 on NOMMU (and make sure to change the "& 3" to "& (VMACACHE_SIZE-1)". Just to keep the size down on small systems that really don't need it. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/