Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp658802imm; Tue, 15 May 2018 07:18:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpnW4k3uIsl+Tuq+PuaZjb+6D2Olap/LsXD7EradZy8Q6sCt4dSJy+WFR71GlzQrDBeXA1Y X-Received: by 2002:a17:902:6181:: with SMTP id u1-v6mr14466572plj.272.1526393936389; Tue, 15 May 2018 07:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526393936; cv=none; d=google.com; s=arc-20160816; b=jarYrdeSecKWxwvB9haF220yXNUCz8lrnQdIsCAtjuDMfmjgrbJYWVTy5FYVCxaJZU yaOWreS6JQDDu+StI7BidaNTg5ZAYflqJdnSBP/dX1WA/NVD6u43UvNcRPlU6mrMowbc Fwx/KpB6u4yZvG1Hw8NZ0I4NYZvT/IVeE/UV6QRptzFToWZWZv193tIGIhyg4Q7p/x3Z A7R3u5CEO4kpQAuxwYIUSotVoLUEUJlR/MwKhd/vdz0VyOdTY+DPovZL5BYtvH42iU1s WOScZJDRZJ4Dr2OQuLj++s5HFGkNeu/cj4lnEeeFTwdy65NUEu4zkkM/DCdVHXi9xPfT 3ZMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=7n8iC1eGsD2g20RNEM5OJ9hsuNARyBWUaB05PCr5tQc=; b=VnkhJ8wUfvvhNkTEwyd5tEbectL47sDX58knKfJWsUAdtazwgJmWckrdZiEUCPIhfL /SKFaYPMPOAz4hLQQkp67/vMckk8iGwibErvTZM7eu+4akTpt6gdoZEZ416APcTfiypL hFAf2onWi7nt3qxOiW0ZchTXTAnnj0kJj533aa14IFSPiet/tVXNMwMlg+y2WrUxoQhl nW18AclANw3Egog7+sw09GJK7CHLY8iCaEQv9BBz09czin/i8O5shnk/aKcua8l19K/i PL3dMmz7Bl19p5zrsZ2nV9Re7mXJvCIKgjIc4pOJ7FDdE9ih3d/M94Kg9daRaMDT+NwA DVLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=G6FG20K5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3-v6si123001pls.64.2018.05.15.07.18.42; Tue, 15 May 2018 07:18:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=G6FG20K5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753697AbeEOORr (ORCPT + 99 others); Tue, 15 May 2018 10:17:47 -0400 Received: from merlin.infradead.org ([205.233.59.134]:54930 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753360AbeEOORp (ORCPT ); Tue, 15 May 2018 10:17:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7n8iC1eGsD2g20RNEM5OJ9hsuNARyBWUaB05PCr5tQc=; b=G6FG20K5WHfnWuhSiUGtRsFyP r0UZtRZSesql8YE1IIsk1I6KVmJcTkXf9EWsgn//+tiW9roYLWL8OMEr6Yxd2J+CSfi47aKOWLpDt qUnPO/y/xehClb4bxxVV42F+41TSeI2aTo7V5J39Xs9h62SvkMP+cTpfpYv8ZhFvEk4YUBFlG9b7Z 5fhyYLBnfX0UOFEbMM98U5HlLDiAOSWTSQaWH48JoukO9qagfnAaGxcBO4PrBbl09brRfzKVjeDJB DtqvnS/fIAe4pxp8SOnVnGh9ESo1bsQp938QFDjjEQikn7R1+1OTM/+RdEyhSRzGTXnHuhYJJnh1h atfxXif5Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIalX-0005RD-B0; Tue, 15 May 2018 14:17:23 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C14BA2029F1C1; Tue, 15 May 2018 16:17:21 +0200 (CEST) Date: Tue, 15 May 2018 16:17:21 +0200 From: Peter Zijlstra To: Boaz Harrosh Cc: Matthew Wilcox , Andrew Morton , Jeff Moyer , "Kirill A. Shutemov" , linux-kernel , linux-fsdevel , "linux-mm@kvack.org" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Dave Hansen , Rik van Riel , Jan Kara , Matthew Wilcox , Amit Golander Subject: Re: [PATCH] mm: Add new vma flag VM_LOCAL_CPU Message-ID: <20180515141721.GF12217@hirez.programming.kicks-ass.net> References: <0efb5547-9250-6b6c-fe8e-cf4f44aaa5eb@netapp.com> <20180514144901.0fe99d240ff8a53047dd512e@linux-foundation.org> <20180515004406.GB5168@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 15, 2018 at 02:54:29PM +0300, Boaz Harrosh wrote: > At the beginning I was wishful thinking that the mm_cpumask(vma->vm_mm) > should have a single bit set just as the affinity of the thread on > creation of that thread. But then I saw that at %80 of the times some > other random bits are also set. > > Yes Random. Always the thread affinity (single) bit was set but > then zero one or two more bits were set as well. Never seen more then > two though, which baffles me a lot. > > If it was like Matthew said .i.e the cpumask of the all process > then I would expect all the bits to be set. Because I have a thread > on each core. And also I would even expect that all vma->vm_mm > or maybe mm_cpumask(vma->vm_mm) to point to the same global object. > But it was not so. it was pointing to some thread unique object but > still those phantom bits were set all over. (And I am almost sure > same vma had those bits change over time) > > So I would love some mm guy to explain where are those bits collected? Depends on the architecture, some architectures only ever set bits, some, like x86, clear bits again. You want to look at switch_mm(). Basically x86 clears the bit again when we switch away from the mm and have/will invalidate TLBs for it in doing so. > Which brings me to another question. How can I find from > within a thread Say at the file_operations->mmap() call that the thread > is indeed core-pinned. What mm_cpumask should I inspect? is_percpu_thread().