All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Michal Hocko <mhocko@kernel.org>
Cc: ysxie@foxmail.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, n-horiguchi@ah.jp.nec.com,
	akpm@linux-foundation.org, vbabka@suse.cz,
	mgorman@techsingularity.net, hannes@cmpxchg.org,
	iamjoonsoo.kim@lge.com, izumi.taku@jp.fujitsu.com,
	arbab@linux.vnet.ibm.com, vkuznets@redhat.com,
	ak@linux.intel.com, guohanjun@huawei.com, qiuxishi@huawei.com
Subject: Re: [PATCH v5 1/4] mm/migration: make isolate_movable_page() return int type
Date: Thu, 2 Feb 2017 16:28:26 +0900	[thread overview]
Message-ID: <20170202072826.GC11694@bbox> (raw)
In-Reply-To: <20170201100022.GI5977@dhcp22.suse.cz>

On Wed, Feb 01, 2017 at 11:00:23AM +0100, Michal Hocko wrote:
> On Wed 01-02-17 18:46:36, Minchan Kim wrote:
> > On Wed, Feb 01, 2017 at 08:59:24AM +0100, Michal Hocko wrote:
> > > On Wed 01-02-17 15:48:21, Minchan Kim wrote:
> > > > Hi Yisheng,
> > > > 
> > > > On Tue, Jan 31, 2017 at 09:06:18PM +0800, ysxie@foxmail.com wrote:
> > > > > From: Yisheng Xie <xieyisheng1@huawei.com>
> > > > > 
> > > > > This patch changes the return type of isolate_movable_page()
> > > > > from bool to int. It will return 0 when isolate movable page
> > > > > successfully, return -EINVAL when the page is not a non-lru movable
> > > > > page, and for other cases it will return -EBUSY.
> > > > > 
> > > > > There is no functional change within this patch but prepare
> > > > > for later patch.
> > > > > 
> > > > > Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
> > > > > Suggested-by: Michal Hocko <mhocko@kernel.org>
> > > > 
> > > > Sorry for missing this one you guys were discussing.
> > > > I don't understand the patch's goal although I read later patches.
> > > 
> > > The point is that the failed isolation has to propagate error up the
> > > call chain to the userspace which has initiated the migration.
> > > 
> > > > isolate_movable_pages returns success/fail so that's why I selected
> > > > bool rather than int but it seems you guys want to propagate more
> > > > detailed error to the user so added -EBUSY and -EINVAL.
> > > > 
> > > > But the question is why isolate_lru_pages doesn't have -EINVAL?
> > > 
> > > It doesn't have to same as isolate_movable_pages. We should just return
> > > EBUSY when the page is no longer movable.
> > 
> > Why isolate_lru_page is okay to return -EBUSY in case of race while
> > isolate_movable_page should return -EINVAL?
> > What's the logic in your mind? I totally cannot understand.
> 
> Let me rephrase. Both should return EBUSY.

It means it's binary return value(success: 0 fail : -EBUSY) so IMO,
bool is better and caller should return -EBUSY if that functions
returns *false*. No need to make deeper propagation level.
Anyway, it's trivial so I'm not against it if you want to make
isolate_movable_page returns int. Insetad, please remove -EINVAL
in this patch and just return -EBUSY for isolate_movable_page to
be consistent with isolate_lru_page.
Then, we don't need to fix any driver side, either. Even, no need to
update any document because you don't add any new error value.

That's enough.

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Michal Hocko <mhocko@kernel.org>
Cc: <ysxie@foxmail.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, <n-horiguchi@ah.jp.nec.com>,
	<akpm@linux-foundation.org>, <vbabka@suse.cz>,
	<mgorman@techsingularity.net>, <hannes@cmpxchg.org>,
	<iamjoonsoo.kim@lge.com>, <izumi.taku@jp.fujitsu.com>,
	<arbab@linux.vnet.ibm.com>, <vkuznets@redhat.com>,
	<ak@linux.intel.com>, <guohanjun@huawei.com>,
	<qiuxishi@huawei.com>
Subject: Re: [PATCH v5 1/4] mm/migration: make isolate_movable_page() return int type
Date: Thu, 2 Feb 2017 16:28:26 +0900	[thread overview]
Message-ID: <20170202072826.GC11694@bbox> (raw)
In-Reply-To: <20170201100022.GI5977@dhcp22.suse.cz>

On Wed, Feb 01, 2017 at 11:00:23AM +0100, Michal Hocko wrote:
> On Wed 01-02-17 18:46:36, Minchan Kim wrote:
> > On Wed, Feb 01, 2017 at 08:59:24AM +0100, Michal Hocko wrote:
> > > On Wed 01-02-17 15:48:21, Minchan Kim wrote:
> > > > Hi Yisheng,
> > > > 
> > > > On Tue, Jan 31, 2017 at 09:06:18PM +0800, ysxie@foxmail.com wrote:
> > > > > From: Yisheng Xie <xieyisheng1@huawei.com>
> > > > > 
> > > > > This patch changes the return type of isolate_movable_page()
> > > > > from bool to int. It will return 0 when isolate movable page
> > > > > successfully, return -EINVAL when the page is not a non-lru movable
> > > > > page, and for other cases it will return -EBUSY.
> > > > > 
> > > > > There is no functional change within this patch but prepare
> > > > > for later patch.
> > > > > 
> > > > > Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
> > > > > Suggested-by: Michal Hocko <mhocko@kernel.org>
> > > > 
> > > > Sorry for missing this one you guys were discussing.
> > > > I don't understand the patch's goal although I read later patches.
> > > 
> > > The point is that the failed isolation has to propagate error up the
> > > call chain to the userspace which has initiated the migration.
> > > 
> > > > isolate_movable_pages returns success/fail so that's why I selected
> > > > bool rather than int but it seems you guys want to propagate more
> > > > detailed error to the user so added -EBUSY and -EINVAL.
> > > > 
> > > > But the question is why isolate_lru_pages doesn't have -EINVAL?
> > > 
> > > It doesn't have to same as isolate_movable_pages. We should just return
> > > EBUSY when the page is no longer movable.
> > 
> > Why isolate_lru_page is okay to return -EBUSY in case of race while
> > isolate_movable_page should return -EINVAL?
> > What's the logic in your mind? I totally cannot understand.
> 
> Let me rephrase. Both should return EBUSY.

It means it's binary return value(success: 0 fail : -EBUSY) so IMO,
bool is better and caller should return -EBUSY if that functions
returns *false*. No need to make deeper propagation level.
Anyway, it's trivial so I'm not against it if you want to make
isolate_movable_page returns int. Insetad, please remove -EINVAL
in this patch and just return -EBUSY for isolate_movable_page to
be consistent with isolate_lru_page.
Then, we don't need to fix any driver side, either. Even, no need to
update any document because you don't add any new error value.

That's enough.

  reply	other threads:[~2017-02-02  7:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-31 13:06 [PATCH v5 0/4] HWPOISON: soft offlining for non-lru movable page ysxie
2017-01-31 13:06 ` ysxie
2017-01-31 13:06 ` [PATCH v5 1/4] mm/migration: make isolate_movable_page() return int type ysxie
2017-01-31 13:06   ` ysxie
2017-02-01  6:48   ` Minchan Kim
2017-02-01  6:48     ` Minchan Kim
2017-02-01  7:59     ` Michal Hocko
2017-02-01  7:59       ` Michal Hocko
2017-02-01  9:46       ` Minchan Kim
2017-02-01  9:46         ` Minchan Kim
2017-02-01 10:00         ` Michal Hocko
2017-02-01 10:00           ` Michal Hocko
2017-02-02  7:28           ` Minchan Kim [this message]
2017-02-02  7:28             ` Minchan Kim
2017-02-03  1:42             ` Yisheng Xie
2017-02-03  1:42               ` Yisheng Xie
2017-02-03  1:27         ` Yisheng Xie
2017-02-03  1:27           ` Yisheng Xie
2017-01-31 13:06 ` [PATCH v5 2/4] mm/migration: make isolate_movable_page always defined ysxie
2017-01-31 13:06   ` ysxie
2017-01-31 13:06 ` [PATCH v5 3/4] HWPOISON: soft offlining for non-lru movable page ysxie
2017-01-31 13:06   ` ysxie

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=20170202072826.GC11694@bbox \
    --to=minchan@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arbab@linux.vnet.ibm.com \
    --cc=guohanjun@huawei.com \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=qiuxishi@huawei.com \
    --cc=vbabka@suse.cz \
    --cc=vkuznets@redhat.com \
    --cc=ysxie@foxmail.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.