Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572174

Re: [PATCH v5 1/4] mm/migration: make isolate_movable_page() return int type

From Minchan Kim <minchan@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v5 1/4] mm/migration: make isolate_movable_page() return int type
Date 2017-02-02 08:40 +0100
Message-ID <t6k9P-Pa-5@gated-at.bofh.it> (permalink)
References (1 earlier) <t5GFs-1cI-27@gated-at.bofh.it> <t5WTT-2r3-1@gated-at.bofh.it> <t5XZD-33q-1@gated-at.bofh.it> <t5ZI6-4dz-25@gated-at.bofh.it> <t601t-4A9-57@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 1/4] mm/migration: make isolate_movable_page() return int type ysxie@foxmail.com - 2017-01-31 14:30 +0100
  Re: [PATCH v5 1/4] mm/migration: make isolate_movable_page() return  int type Minchan Kim <minchan@kernel.org> - 2017-02-01 07:50 +0100
    Re: [PATCH v5 1/4] mm/migration: make isolate_movable_page() return  int type Michal Hocko <mhocko@kernel.org> - 2017-02-01 09:00 +0100
      Re: [PATCH v5 1/4] mm/migration: make isolate_movable_page() return  int type Minchan Kim <minchan@kernel.org> - 2017-02-01 10:50 +0100
        Re: [PATCH v5 1/4] mm/migration: make isolate_movable_page() return  int type Michal Hocko <mhocko@kernel.org> - 2017-02-01 11:10 +0100
          Re: [PATCH v5 1/4] mm/migration: make isolate_movable_page() return  int type Minchan Kim <minchan@kernel.org> - 2017-02-02 08:40 +0100
            Re: [PATCH v5 1/4] mm/migration: make isolate_movable_page() return  int type Yisheng Xie <xieyisheng1@huawei.com> - 2017-02-03 02:50 +0100
        Re: [PATCH v5 1/4] mm/migration: make isolate_movable_page() return  int type Yisheng Xie <xieyisheng1@huawei.com> - 2017-02-03 02:30 +0100

csiph-web