From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752146AbdKFKoK (ORCPT ); Mon, 6 Nov 2017 05:44:10 -0500 Received: from mx2.suse.de ([195.135.220.15]:52236 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751777AbdKFKoJ (ORCPT ); Mon, 6 Nov 2017 05:44:09 -0500 Date: Mon, 6 Nov 2017 11:43:54 +0100 From: Michal Hocko To: Peter Zijlstra Cc: Bart Van Assche , "yang.s@alibaba-inc.com" , "akpm@linux-foundation.org" , "joe@perches.com" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "mingo@redhat.com" Subject: Re: [PATCH] mm: use in_atomic() in print_vma_addr() Message-ID: <20171106104354.2jlgd2m4j4gxx4qo@dhcp22.suse.cz> References: <1509572313-102989-1-git-send-email-yang.s@alibaba-inc.com> <20171102075744.whhxjmqbdkfaxghd@dhcp22.suse.cz> <20171103110245.7049460a05cc18c7e8a9feb2@linux-foundation.org> <1509739786.2473.33.camel@wdc.com> <20171105081946.yr2pvalbegxygcky@dhcp22.suse.cz> <20171106100558.GD3165@worktop.lehotels.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171106100558.GD3165@worktop.lehotels.local> 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 Mon 06-11-17 11:05:58, Peter Zijlstra wrote: > On Sun, Nov 05, 2017 at 09:19:46AM +0100, Michal Hocko wrote: > > [CC Peter] > > > > On Fri 03-11-17 20:09:49, Bart Van Assche wrote: > > > On Fri, 2017-11-03 at 11:02 -0700, Andrew Morton wrote: > > > > Also, checkpatch says > > > > > > > > WARNING: use of in_atomic() is incorrect outside core kernel code > > > > #43: FILE: mm/memory.c:4491: > > > > + if (in_atomic()) > > > > > > > > I don't recall why we did that, but perhaps this should be revisited? > > > > > > Is the comment above in_atomic() still up-to-date? From : > > > > > > /* > > > * Are we running in atomic context? WARNING: this macro cannot > > > * always detect atomic context; in particular, it cannot know about > > > * held spinlocks in non-preemptible kernels. Thus it should not be > > > * used in the general case to determine whether sleeping is possible. > > > * Do not use in_atomic() in driver code. > > > */ > > > #define in_atomic() (preempt_count() != 0) > > > > I can still see preempt_disable NOOP for !CONFIG_PREEMPT_COUNT kernels > > which makes me think this is still a valid comment. > > 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? -- Michal Hocko SUSE Labs From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f72.google.com (mail-pg0-f72.google.com [74.125.83.72]) by kanga.kvack.org (Postfix) with ESMTP id C94B06B026F for ; Mon, 6 Nov 2017 05:44:10 -0500 (EST) Received: by mail-pg0-f72.google.com with SMTP id a192so12417768pge.1 for ; Mon, 06 Nov 2017 02:44:10 -0800 (PST) Received: from mx2.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id m18si11866331pfh.138.2017.11.06.02.44.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 06 Nov 2017 02:44:09 -0800 (PST) Date: Mon, 6 Nov 2017 11:43:54 +0100 From: Michal Hocko Subject: Re: [PATCH] mm: use in_atomic() in print_vma_addr() Message-ID: <20171106104354.2jlgd2m4j4gxx4qo@dhcp22.suse.cz> References: <1509572313-102989-1-git-send-email-yang.s@alibaba-inc.com> <20171102075744.whhxjmqbdkfaxghd@dhcp22.suse.cz> <20171103110245.7049460a05cc18c7e8a9feb2@linux-foundation.org> <1509739786.2473.33.camel@wdc.com> <20171105081946.yr2pvalbegxygcky@dhcp22.suse.cz> <20171106100558.GD3165@worktop.lehotels.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171106100558.GD3165@worktop.lehotels.local> Sender: owner-linux-mm@kvack.org List-ID: To: Peter Zijlstra Cc: Bart Van Assche , "yang.s@alibaba-inc.com" , "akpm@linux-foundation.org" , "joe@perches.com" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "mingo@redhat.com" On Mon 06-11-17 11:05:58, Peter Zijlstra wrote: > On Sun, Nov 05, 2017 at 09:19:46AM +0100, Michal Hocko wrote: > > [CC Peter] > > > > On Fri 03-11-17 20:09:49, Bart Van Assche wrote: > > > On Fri, 2017-11-03 at 11:02 -0700, Andrew Morton wrote: > > > > Also, checkpatch says > > > > > > > > WARNING: use of in_atomic() is incorrect outside core kernel code > > > > #43: FILE: mm/memory.c:4491: > > > > + if (in_atomic()) > > > > > > > > I don't recall why we did that, but perhaps this should be revisited? > > > > > > Is the comment above in_atomic() still up-to-date? From : > > > > > > /* > > > * Are we running in atomic context? WARNING: this macro cannot > > > * always detect atomic context; in particular, it cannot know about > > > * held spinlocks in non-preemptible kernels. Thus it should not be > > > * used in the general case to determine whether sleeping is possible. > > > * Do not use in_atomic() in driver code. > > > */ > > > #define in_atomic() (preempt_count() != 0) > > > > I can still see preempt_disable NOOP for !CONFIG_PREEMPT_COUNT kernels > > which makes me think this is still a valid comment. > > 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? -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org