From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752186AbdK2HWS (ORCPT ); Wed, 29 Nov 2017 02:22:18 -0500 Received: from mx2.suse.de ([195.135.220.15]:34316 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752076AbdK2HWO (ORCPT ); Wed, 29 Nov 2017 02:22:14 -0500 Date: Wed, 29 Nov 2017 08:22:11 +0100 From: Michal Hocko To: Will Deacon Cc: linux-mm@kvack.org, Minchan Kim , Andrea Argangeli , Ingo Molnar , Andrew Morton , Linus Torvalds , LKML , linux-arch@vger.kernel.org Subject: Re: [RFC PATCH] arch, mm: introduce arch_tlb_gather_mmu_exit Message-ID: <20171129072211.vbjauoqyaj7hcfel@dhcp22.suse.cz> References: <20171123090236.18574-1-mhocko@kernel.org> <20171128190001.GD8187@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171128190001.GD8187@arm.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 28-11-17 19:00:01, Will Deacon wrote: > On Thu, Nov 23, 2017 at 10:02:36AM +0100, Michal Hocko wrote: > > From: Michal Hocko > > > > 5a7862e83000 ("arm64: tlbflush: avoid flushing when fullmm == 1") has > > introduced an optimization to not flush tlb when we are tearing the > > whole address space down. Will goes on to explain > > > > : Basically, we tag each address space with an ASID (PCID on x86) which > > : is resident in the TLB. This means we can elide TLB invalidation when > > : pulling down a full mm because we won't ever assign that ASID to > > : another mm without doing TLB invalidation elsewhere (which actually > > : just nukes the whole TLB). > > > > This all is nice but tlb_gather users are not aware of that and this can > > actually cause some real problems. E.g. the oom_reaper tries to reap the > > whole address space but it might race with threads accessing the memory [1]. > > It is possible that soft-dirty handling might suffer from the same > > problem [2] as soon as it starts supporting the feature. > > > > Introduce an explicit exit variant tlb_gather_mmu_exit which allows the > > behavior arm64 implements for the fullmm case and replace it by an > > explicit exit flag in the mmu_gather structure. exit_mmap path is then > > turned into the explicit exit variant. Other architectures simply ignore > > the flag. > > > > [1] http://lkml.kernel.org/r/20171106033651.172368-1-wangnan0@huawei.com > > [2] http://lkml.kernel.org/r/20171110001933.GA12421@bbox > > Signed-off-by: Michal Hocko > > --- > > Hi, > > I am sending this as an RFC because I am not fully familiar with the tlb > > gather arch implications, espacially the semantic of fullmm. Therefore > > I might duplicate some of its functionality. I hope people on the CC > > list will help me to sort this out. > > > > Comments? Objections? > > I can't think of a case where we'd have exit set but not be doing the > fullmm, in which case I'd be inclined to remove the last two parameters > from tlb_gather_mmu_exit. Makes sense. Will do! -- Michal Hocko SUSE Labs