lkml.org 
[lkml]   [2019]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] mm/z3fold.c: Lock z3fold page before __SetPageMovable()
On Wed, Jul 3, 2019 at 12:24 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Tue, 2 Jul 2019 15:17:47 -0700 Henry Burns <henryburns@google.com> wrote:
>
> > > > > > + if (can_sleep) {
> > > > > > + lock_page(page);
> > > > > > + __SetPageMovable(page, pool->inode->i_mapping);
> > > > > > + unlock_page(page);
> > > > > > + } else {
> > > > > > + if (!WARN_ON(!trylock_page(page))) {
> > > > > > + __SetPageMovable(page, pool->inode->i_mapping);
> > > > > > + unlock_page(page);
> > > > > > + } else {
> > > > > > + pr_err("Newly allocated z3fold page is locked\n");
> > > > > > + WARN_ON(1);
>
> The WARN_ON will have already warned in this case.
>
> But the whole idea of warning in this case may be undesirable. We KNOW
> that the warning will sometimes trigger (yes?). So what's the point in
> scaring users?

Well, normally a newly allocated page that we own should not be locked
by someone else so this is worth a warning IMO. With that said, the
else branch here appears to be redundant.

~Vitaly

\
 
 \ /
  Last update: 2019-07-03 07:55    [W:0.043 / U:6.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site