Received: by 10.223.164.202 with SMTP id h10csp402066wrb; Mon, 6 Nov 2017 08:30:29 -0800 (PST) X-Google-Smtp-Source: ABhQp+TbCnShjGSshncfZ7DJ3pPIb7MqY+rI4QF39S0kCuleuYRpPepzxyAqaI0c5xTOyRhkxJcZ X-Received: by 10.98.56.204 with SMTP id f195mr17531105pfa.188.1509985829308; Mon, 06 Nov 2017 08:30:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509985829; cv=none; d=google.com; s=arc-20160816; b=rgIlUxCeSzhaTxzqKCSfr/tve/YXzC6gzYv9N/QRiS5etnlf7++0k/XKdqU4UTKx82 dHjKprytjH4b+tkIPEp2C6w6+/0YDN9vMiuqugMZMhONzLEp0ijqsyTyRB0S6gI0z+3H xUPVlShFWDOSnthz9v1sgnFvMtI5deuxFOJRQe3grf9sCXHJ41KI2aUr3DlRdbLME/n2 3gibz91dRMPYyuHXTCB4qoEDbvgG0uQgw+FKMhmBvixh7bxnuNPKJ3At81Mdt04KMPh9 4hjlzHUuFpWDUgh63uXIoFlioM94n45nl9KZ3AReEA7bkHl8R+CK7QNWBN5sudlqAEDn sfBQ== 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:arc-authentication-results; bh=dcC5qfRkAYSTg/nrzQbXMfHOBK3A/F+VCugquO6SsUc=; b=s9hGjqnFsozO5bNx0OiO4hQWLPv1+B/045za8BZ/HIS0tcjaFi+AgFgfU7E5PoOrxV 0WuIKtibnIzP6V8e7YT54GGOgckVilOoD6ovCDbmYONc0r8QpxGOoNPY1JDHnF3YVeBi XHsXwlU0Lvdumn2YrzOaypJCuPOM/2iM7mdHWj6eOq9+Wt5YPtlNYww97iUu6iP6jZJF Erwbzw1Uw/l42zfNMZQAltQgOjmITNFhqEbtaj/r1d5BPGz+RzJdfgFuFMpXU8YXgycr xtqn9k37mlIzdSEKylIZjmog6iKPblxCPs+2g88297Ht6RmHw0cQhVKttFUn3+sUYIK5 hxlQ== ARC-Authentication-Results: i=1; mx.google.com; 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 n3si10474701pld.602.2017.11.06.08.30.14; Mon, 06 Nov 2017 08:30:29 -0800 (PST) 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; 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 S1753733AbdKFQYY (ORCPT + 97 others); Mon, 6 Nov 2017 11:24:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:37147 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752211AbdKFQYX (ORCPT ); Mon, 6 Nov 2017 11:24:23 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F03D5AD14; Mon, 6 Nov 2017 16:24:21 +0000 (UTC) Date: Mon, 6 Nov 2017 17:24:20 +0100 From: Michal Hocko To: Yang Shi Cc: Peter Zijlstra , Bart Van Assche , "akpm@linux-foundation.org" , "joe@perches.com" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "mingo@redhat.com" Subject: Re: [PATCH] mm: do not rely on preempt_count in print_vma_addr Message-ID: <20171106162420.lrt2n524fwn6u4ev@dhcp22.suse.cz> References: <20171103110245.7049460a05cc18c7e8a9feb2@linux-foundation.org> <1509739786.2473.33.camel@wdc.com> <20171105081946.yr2pvalbegxygcky@dhcp22.suse.cz> <20171106100558.GD3165@worktop.lehotels.local> <20171106104354.2jlgd2m4j4gxx4qo@dhcp22.suse.cz> <20171106120025.GH3165@worktop.lehotels.local> <20171106121222.nnzrr4cb7s7y5h74@dhcp22.suse.cz> <20171106134031.g6dbelg55mrbyc6i@dhcp22.suse.cz> <8665ccad-fa48-b835-c2e0-e50a4f05f319@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8665ccad-fa48-b835-c2e0-e50a4f05f319@alibaba-inc.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 07-11-17 00:16:58, Yang Shi wrote: > > > On 11/6/17 5:40 AM, Michal Hocko wrote: > > On Mon 06-11-17 13:12:22, Michal Hocko wrote: > > > On Mon 06-11-17 13:00:25, Peter Zijlstra wrote: > > > > On Mon, Nov 06, 2017 at 11:43:54AM +0100, Michal Hocko wrote: > > > > > > Yes the comment is very much accurate. > > > > > > > > > > Which suggests that print_vma_addr might be problematic, right? > > > > > Shouldn't we do trylock on mmap_sem instead? > > > > > > > > Yes that's complete rubbish. trylock will get spurious failures to print > > > > when the lock is contended. > > > > > > Yes, but I guess that it is acceptable to to not print the state under > > > that condition. > > > > So what do you think about this? I think this is more robust than > > playing tricks with the explicit preempt count checks and less tedious > > than checking to make it conditional on the context. This is on top of > > Linus tree and if accepted it should replace the patch discussed here. > > --- > > From 0de6d57cbc54ee2686d1f1e4ffcc4ed490ded8aa Mon Sep 17 00:00:00 2001 > > From: Michal Hocko > > Date: Mon, 6 Nov 2017 14:31:20 +0100 > > Subject: [PATCH] mm: do not rely on preempt_count in print_vma_addr > > > > The preempt count check on print_vma_addr has been added by e8bff74afbdb > > ("x86: fix "BUG: sleeping function called from invalid context" in > > print_vma_addr()") and it relied on the elevated preempt count from > > preempt_conditional_sti because preempt_count check doesn't work on > > non preemptive kernels by default. The code has evolved though and > > d99e1bd175f4 ("x86/entry/traps: Refactor preemption and interrupt flag > > handling") has replaced preempt_conditional_sti by an explicit > > preempt_disable which is noop on !PREEMPT so the check in print_vma_addr > > is broken. > > > > Fix the issue by using trylock on mmap_sem rather than chacking the > > s/chacking/checking ups, fixed > > preempt count. The allocation we are relying on has to be GFP_NOWAIT > > as well. There is a chance that we won't dump the vma state if the lock > > is contended or the memory short but this is acceptable outcome and much > > less fragile than the not working preemption check or tricks around it. > > > > Fixes: d99e1bd175f4 ("x86/entry/traps: Refactor preemption and interrupt flag handling") > > Signed-off-by: Michal Hocko > > Acked-by: Yang Shi Thanks! -- Michal Hocko SUSE Labs From 1583327288106533179@xxx Mon Nov 06 14:29:29 +0000 2017 X-GM-THRID: 1583326809651580499 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread