All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Bart Van Assche <Bart.VanAssche@wdc.com>,
	"yang.s@alibaba-inc.com" <yang.s@alibaba-inc.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"joe@perches.com" <joe@perches.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"mingo@redhat.com" <mingo@redhat.com>
Subject: Re: [PATCH] mm: use in_atomic() in print_vma_addr()
Date: Mon, 6 Nov 2017 11:43:54 +0100	[thread overview]
Message-ID: <20171106104354.2jlgd2m4j4gxx4qo@dhcp22.suse.cz> (raw)
In-Reply-To: <20171106100558.GD3165@worktop.lehotels.local>

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 <linux/preempt.h>:
> > > 
> > > /*
> > >  * 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

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Bart Van Assche <Bart.VanAssche@wdc.com>,
	"yang.s@alibaba-inc.com" <yang.s@alibaba-inc.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"joe@perches.com" <joe@perches.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"mingo@redhat.com" <mingo@redhat.com>
Subject: Re: [PATCH] mm: use in_atomic() in print_vma_addr()
Date: Mon, 6 Nov 2017 11:43:54 +0100	[thread overview]
Message-ID: <20171106104354.2jlgd2m4j4gxx4qo@dhcp22.suse.cz> (raw)
In-Reply-To: <20171106100558.GD3165@worktop.lehotels.local>

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 <linux/preempt.h>:
> > > 
> > > /*
> > >  * 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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-11-06 10:44 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 21:38 [PATCH] mm: use in_atomic() in print_vma_addr() Yang Shi
2017-11-01 21:38 ` Yang Shi
2017-11-02  7:57 ` Michal Hocko
2017-11-02  7:57   ` Michal Hocko
2017-11-02 17:44   ` Yang Shi
2017-11-02 17:44     ` Yang Shi
2017-11-03  8:29     ` Michal Hocko
2017-11-03  8:29       ` Michal Hocko
2017-11-03 18:02     ` Andrew Morton
2017-11-03 18:02       ` Andrew Morton
2017-11-03 18:16       ` Yang Shi
2017-11-03 18:16         ` Yang Shi
2017-11-03 20:09       ` Bart Van Assche
2017-11-03 20:09         ` Bart Van Assche
2017-11-05  8:19         ` Michal Hocko
2017-11-05  8:19           ` Michal Hocko
2017-11-06 10:05           ` Peter Zijlstra
2017-11-06 10:05             ` Peter Zijlstra
2017-11-06 10:43             ` Michal Hocko [this message]
2017-11-06 10:43               ` Michal Hocko
2017-11-06 10:56               ` Michal Hocko
2017-11-06 10:56                 ` Michal Hocko
2017-11-06 12:00               ` Peter Zijlstra
2017-11-06 12:00                 ` Peter Zijlstra
2017-11-06 12:12                 ` Michal Hocko
2017-11-06 12:12                   ` Michal Hocko
2017-11-06 13:40                   ` [PATCH] mm: do not rely on preempt_count in print_vma_addr (was: Re: [PATCH] mm: use in_atomic() in print_vma_addr()) Michal Hocko
2017-11-06 13:40                     ` Michal Hocko
2017-11-06 14:19                     ` [PATCH] mm: do not rely on preempt_count in print_vma_addr Vlastimil Babka
2017-11-06 14:19                       ` Vlastimil Babka
2017-11-06 14:28                       ` Michal Hocko
2017-11-06 14:28                         ` Michal Hocko
2017-11-06 16:16                     ` Yang Shi
2017-11-06 16:16                       ` Yang Shi
2017-11-06 16:24                       ` Michal Hocko
2017-11-06 16:24                         ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171106104354.2jlgd2m4j4gxx4qo@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=Bart.VanAssche@wdc.com \
    --cc=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yang.s@alibaba-inc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.