From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18BDEECE58C for ; Fri, 11 Oct 2019 13:08:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C130E206A1 for ; Fri, 11 Oct 2019 13:08:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="dRKTtlJE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C130E206A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 584FF8E0005; Fri, 11 Oct 2019 09:08:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 50EA48E0001; Fri, 11 Oct 2019 09:08:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D5418E0005; Fri, 11 Oct 2019 09:08:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0109.hostedemail.com [216.40.44.109]) by kanga.kvack.org (Postfix) with ESMTP id 15B388E0001 for ; Fri, 11 Oct 2019 09:08:45 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 8ADF6181AC9B6 for ; Fri, 11 Oct 2019 13:08:44 +0000 (UTC) X-FDA: 76031533368.16.drug81_2f1bba4c0fd0b X-HE-Tag: drug81_2f1bba4c0fd0b X-Filterd-Recvd-Size: 6496 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Fri, 11 Oct 2019 13:08:43 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id 7so9760200ljw.7 for ; Fri, 11 Oct 2019 06:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=rianfJYqECdE+QtZW64kQ5yJr8Uz6OZaARSFrVw9bs4=; b=dRKTtlJErIwNFWVHk1FM6s4j/GT2w063GFu4qYGKPW9/iqI/6KiBlI2str4R28wVaW 4rpQ17qOSD4O81+2oGq2m9O/xphLmFW+MxtukVtcsG2m2yAFrtJwl0KCOERCSQf4YP9G qKKzrT4g5wqVcL59YHcAMqGCG3Y9GI5Kc8/mkqhd5D5B/291mg61LC2sZa/roTggWPL0 +uhm7EusNkG0unhs57yT+Un6M86uH0dmgREsXCSwTqKywA7uG+ezCPRSAf4ryOIaI7Iy wZx5Jw8DS/W9L/0d9F30JzgJTBjY6NllJ8YMC5YPnLTC+ZTrTkZcERIxMWKeTC9A0RMx oi/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=rianfJYqECdE+QtZW64kQ5yJr8Uz6OZaARSFrVw9bs4=; b=Zox+U5eSlq/TmJ8CSdHWjQl0/jkD+BXzRRNFmFvf/NF6Dq5kLrpsaEa5PeSz9JiTC4 UnBI1k6LSi/GY3uoGEmaelthe76aPZYLDlMyxglHEnEAq0w0zoJA87YNJ8r+Xi9iqQ1+ VR2Xj70vwSozkBILb7ngGueL+27YTHZ6VpZgvt8qke8a8AXlYJCyolbI7akwlj1F/2cU FLiVNX5Zjj2K3jDTXNVoD2jCNfmzRP0g4ZNSb5utSzgNfEBc4k3xjKHb6JrFdyFXyZ2R 5SWIQZH5LIET0p69cKX47i0DZ4iFxI4hRSsm/e0Dhq3xPrqMvrMbqubI+jxKaF0JcFa/ NbWA== X-Gm-Message-State: APjAAAV69J1gGSaS+518JaWsyhm3hp2qHS30OTOPkG8rmCMu67SYJXkE XA+5gjpyRBvoxF/gHUblo8b4XhTrvf0= X-Google-Smtp-Source: APXvYqwypjthT7nDft61JPMpe4A6BPPPb5GutnCDtzzxJ0ODUqmxKoczKMz8zINqEEhUApStCMTFBg== X-Received: by 2002:a2e:9bd2:: with SMTP id w18mr9323694ljj.140.1570799321440; Fri, 11 Oct 2019 06:08:41 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id i11sm1952023ljb.74.2019.10.11.06.08.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2019 06:08:40 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id C7973102DC1; Fri, 11 Oct 2019 16:08:40 +0300 (+03) Date: Fri, 11 Oct 2019 16:08:40 +0300 From: "Kirill A. Shutemov" To: Thomas =?utf-8?Q?Hellstr=C3=B6m_=28VMware=29?= Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, torvalds@linux-foundation.org, Thomas Hellstrom Subject: Re: [RFC PATCH 1/4] mm: Have the mempolicy pagewalk to avoid positive callback return codes Message-ID: <20191011130840.qusspibjxb7iswuq@box> References: <20191010134058.11949-1-thomas_os@shipmail.org> <20191010134058.11949-2-thomas_os@shipmail.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20191010134058.11949-2-thomas_os@shipmail.org> User-Agent: NeoMutt/20180716 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Oct 10, 2019 at 03:40:55PM +0200, Thomas Hellstr=F6m (VMware) wro= te: > From: Linus Torvalds >=20 > The pagewalk code is being reworked to have positive callback return co= des > do walk control. Avoid using positive return codes: "1" is replaced by > "-EBUSY". >=20 > Co-developed-by: Thomas Hellstrom > Signed-off-by: Thomas Hellstrom > --- > mm/mempolicy.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) >=20 > diff --git a/mm/mempolicy.c b/mm/mempolicy.c > index 4ae967bcf954..df34c7498c27 100644 > --- a/mm/mempolicy.c > +++ b/mm/mempolicy.c > @@ -482,8 +482,8 @@ static int queue_pages_pmd(pmd_t *pmd, spinlock_t *= ptl, unsigned long addr, > * > * queue_pages_pte_range() has three possible return values: > * 0 - pages are placed on the right node or queued successfully. > - * 1 - there is unmovable page, and MPOL_MF_MOVE* & MPOL_MF_STRICT wer= e > - * specified. > + * -EBUSY - there is unmovable page, and MPOL_MF_MOVE* & MPOL_MF_STRIC= T were > + * specified. > * -EIO - only MPOL_MF_STRICT was specified and an existing page was a= lready > * on a node that does not follow the policy. > */ > @@ -503,7 +503,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsign= ed long addr, > if (ptl) { > ret =3D queue_pages_pmd(pmd, ptl, addr, end, walk); > if (ret !=3D 2) > - return ret; > + return (ret =3D=3D 1) ? -EBUSY : ret; It would be cleaner to propagate the error code logic to queue_pages_pmd(= ) too: 0 - placed, 1 - split, -EBUSY - unmovable, ... > } > /* THP was split, fall through to pte walk */ > =20 > @@ -546,7 +546,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsign= ed long addr, > cond_resched(); > =20 > if (has_unmovable) > - return 1; > + return -EBUSY; > =20 > return addr !=3D end ? -EIO : 0; > } > @@ -669,9 +669,9 @@ static const struct mm_walk_ops queue_pages_walk_op= s =3D { > * passed via @private. > * > * queue_pages_range() has three possible return values: > - * 1 - there is unmovable page, but MPOL_MF_MOVE* & MPOL_MF_STRICT wer= e > - * specified. > * 0 - queue pages successfully or no misplaced page. > + * -EBUSY - there is unmovable page, but MPOL_MF_MOVE* & MPOL_MF_STRIC= T were > + * specified. > * -EIO - there is misplaced page and only MPOL_MF_STRICT was specifie= d. > */ > static int > @@ -1285,7 +1285,7 @@ static long do_mbind(unsigned long start, unsigne= d long len, > ret =3D queue_pages_range(mm, start, end, nmask, > flags | MPOL_MF_INVERT, &pagelist); > =20 > - if (ret < 0) { > + if (ret < 0 && ret !=3D -EBUSY) { > err =3D -EIO; > goto up_out; > } > @@ -1303,7 +1303,7 @@ static long do_mbind(unsigned long start, unsigne= d long len, > putback_movable_pages(&pagelist); > } > =20 > - if ((ret > 0) || (nr_failed && (flags & MPOL_MF_STRICT))) > + if ((ret < 0) || (nr_failed && (flags & MPOL_MF_STRICT))) > err =3D -EIO; > } else > putback_movable_pages(&pagelist); > --=20 > 2.21.0 >=20 --=20 Kirill A. Shutemov