linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>,
	Petr Holasek <pholasek@redhat.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 6/6] ksm: unstable_tree_search_insert error checking cleanup
Date: Sun, 1 Nov 2015 16:23:11 -0800 (PST)	[thread overview]
Message-ID: <alpine.LSU.2.11.1511011617150.11840@eggly.anvils> (raw)
In-Reply-To: <20151101234558.GT5390@redhat.com>

On Mon, 2 Nov 2015, Andrea Arcangeli wrote:
> On Sun, Oct 25, 2015 at 04:18:05PM -0700, Hugh Dickins wrote:
> > On Thu, 15 Oct 2015, Andrea Arcangeli wrote:
> > 
> > > get_mergeable_page() can only return NULL (in case of errors) or the
> > > pinned mergeable page. It can't return an error different than
> > > NULL. This makes it more readable and less confusion in addition to
> > > optimizing the check.
> > > 
> > > Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
> > 
> > I share your sentiment, prefer to avoid an unnecessary IS_ERR_OR_NULL.
> > And you may be right that it's unnecessary; but that's far from clear
> > to me, and you haven't changed the IS_ERR_OR_NULL after follow_page()
> > in get_mergeable_page() where it originates, so I wonder if you just
> > got confused on this.
> > 
> > Even if you have established that there's currently no way that
> > follow_page(vma, addr, FOLL_GET) could return an -errno on a vma
> > validated by find_mergeable_vma(), I think we'd still be better off
> > to allow for some future -errno there; but I'd be happy for you to
> > keep the change below, but also adjust get_mergeable_page() to
> > convert an -errno immediately to NULL after follow_page().
> > 
> > So, I think this is gently Nacked in its present form,
> > but a replacement eagerly Acked.
> 
> The "out:" label is followed by page = NULL, so if follow_page returns
> an error, get_mergeable_page still cannot return an error.

Ah, yes, I missed that, thanks.

Acked-by: Hugh Dickins <hughd@google.com>

> 
> If this wasn't the case, get_mergeable_page would return an
> uninitialized pointer if find_mergeable_vma would return NULL.
> 
> I guess the IS_ERR_OR_NULL that I removed, was the direct result of
> overlooking the location of the "out:".
> 
> If there was a return after the "out:" the readability would have been
> improved, but I haven't touched the code around the "out:". That's the
> way it was before. Now I'll add a return in this same patch after the
> "out:" before resubmitting without 1/6.

I can't very well claim now that it was readable before, can I?-)
We'll see; I wouldn't mind if you leave this patch as is.

Hugh

--
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:[~2015-11-02  0:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 16:04 [PATCH 0/6] KSM fixes Andrea Arcangeli
2015-10-15 16:04 ` [PATCH 1/6] ksm: fix rmap_item->anon_vma memory corruption and vma user after free Andrea Arcangeli
2015-10-26  0:12   ` Hugh Dickins
2015-10-30 18:55     ` Andrea Arcangeli
2015-10-15 16:04 ` [PATCH 2/6] ksm: add cond_resched() to the rmap_walks Andrea Arcangeli
2015-10-25 23:41   ` Hugh Dickins
2015-10-27  0:32     ` Davidlohr Bueso
2015-11-01 22:19       ` Andrea Arcangeli
2015-10-15 16:04 ` [PATCH 3/6] ksm: don't fail stable tree lookups if walking over stale stable_nodes Andrea Arcangeli
2015-10-25 23:34   ` Hugh Dickins
2015-11-01 23:03     ` Andrea Arcangeli
2015-10-15 16:04 ` [PATCH 4/6] ksm: use the helper method to do the hlist_empty check Andrea Arcangeli
2015-10-25 23:22   ` Hugh Dickins
2015-10-15 16:04 ` [PATCH 5/6] ksm: use find_mergeable_vma in try_to_merge_with_ksm_page Andrea Arcangeli
2015-10-25 23:21   ` Hugh Dickins
2015-10-15 16:04 ` [PATCH 6/6] ksm: unstable_tree_search_insert error checking cleanup Andrea Arcangeli
2015-10-25 23:18   ` Hugh Dickins
2015-11-01 23:45     ` Andrea Arcangeli
2015-11-02  0:23       ` Hugh Dickins [this message]

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=alpine.LSU.2.11.1511011617150.11840@eggly.anvils \
    --to=hughd@google.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=pholasek@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox