Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp255231ybg; Thu, 17 Oct 2019 22:30:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwTuks/M15d4pUnwsC4zvK8azr3pUD55U7c2YHf4qvnxt4K+snRj79cPSNfuiydm+UAER9 X-Received: by 2002:a50:f742:: with SMTP id j2mr7588447edn.253.1571376618009; Thu, 17 Oct 2019 22:30:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571376618; cv=none; d=google.com; s=arc-20160816; b=YFj2NtZpoeEXUd2KOyDAAcaIxop6JR+FMb6i9bN7fcQimZ3Qo9sDrDOhCnwS8s9BRr rznubYTAzXWu6koFXF3xnUpc48L/zJpv/TMQA+uEk4f8gDn2bfGTB64wjJRWA2ktSXEd nRh7OxIeLgspivWkgbOMPZWE1v+2KdaHrGXb8iH22wIzHYTiuLFOWnJ7oAjAjmaDv7H3 C5U1RqEkTgX38/5S5MAbdBoNb94gPZxcD4DhTCPhyxt4lcPIWxWmxPRfQDhWpmrSaoEW bKhI83nlJkFebNpdN7ujfaFElybs+6wauhSasHg/N8ox84P6MV1EEWQXU+WJEyOflapz vhpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=hfVV7Bwmdxs0OeRl+Gq8sDmQDgiV1QKKC+epvsiRg74=; b=xLjy4ah+jnm+e6m0bybRlOq7KIHuseQh4rMN0NtPQxFMbBYmRaS+qhMbm/9YfQTw1E uc/CHmFrpwGbw7vs6psL7Hn1CRh3dmbHDFU00MM07G1xt+m0Z66011B8qS4Gp+DcUk4C 0HkZiunfZiX4rhsBZkXipyqeNHiV7KrWNHRc4r3BtggntzMuzhpDVloXEvA1HSSTCM3T M66y4ovNkyEgc24VrwMNR+axsnK2Zm0ufgsxAArjmc7tBWpZQw4DpySKnApC/V0ycGPZ 6h10cw9RndWUWhKWMZZa22C8Cx4dZfQlV5WglPWvvEzq9wcJhEtYKSdfUjKJWVL0iAdG hCpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g25si3051703eds.210.2019.10.17.22.29.54; Thu, 17 Oct 2019 22:30:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391440AbfJQBib (ORCPT + 99 others); Wed, 16 Oct 2019 21:38:31 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:4195 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727399AbfJQBib (ORCPT ); Wed, 16 Oct 2019 21:38:31 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C435A5000E3F6047F88E; Thu, 17 Oct 2019 09:38:29 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Thu, 17 Oct 2019 09:38:27 +0800 Message-ID: <5DA7C612.1090300@huawei.com> Date: Thu, 17 Oct 2019 09:38:26 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Andrew Morton CC: John Hubbard , Vlastimil Babka , , , , , Ira Weiny , "Aneesh Kumar K.V" Subject: Re: [PATCH] mm: Unsigned 'nr_pages' always larger than zero References: <1567592763-25282-1-git-send-email-zhongjiang@huawei.com> <5505fa16-117e-8890-0f48-38555a61a036@suse.cz> <20190904114820.42d9c4daf445ded3d0da52ab@linux-foundation.org> <73c49a1b-4f42-c21d-ccd8-2b063cdf1293@nvidia.com> <5DA6DDE0.6000804@huawei.com> <20191016174955.300d5fd4968537151d3ad43f@linux-foundation.org> In-Reply-To: <20191016174955.300d5fd4968537151d3ad43f@linux-foundation.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/10/17 8:49, Andrew Morton wrote: > On Wed, 16 Oct 2019 17:07:44 +0800 zhong jiang wrote: > >>>> --- a/mm/gup.c~a >>>> +++ a/mm/gup.c >>>> @@ -1450,6 +1450,7 @@ static long check_and_migrate_cma_pages( >>>> bool drain_allow = true; >>>> bool migrate_allow = true; >>>> LIST_HEAD(cma_page_list); >>>> + long ret; >>>> check_again: >>>> for (i = 0; i < nr_pages;) { >>>> @@ -1511,17 +1512,18 @@ check_again: >>>> * again migrating any new CMA pages which we failed to isolate >>>> * earlier. >>>> */ >>>> - nr_pages = __get_user_pages_locked(tsk, mm, start, nr_pages, >>>> + ret = __get_user_pages_locked(tsk, mm, start, nr_pages, >>>> pages, vmas, NULL, >>>> gup_flags); >>>> - if ((nr_pages > 0) && migrate_allow) { >>>> + nr_pages = ret; >>>> + if (ret > 0 && migrate_allow) { >>>> drain_allow = true; >>>> goto check_again; >>>> } >>>> } >>>> - return nr_pages; >>>> + return ret; >>>> } >>>> #else >>>> static long check_and_migrate_cma_pages(struct task_struct *tsk, >>>> >>> +1 for this approach, please. >>> >>> >>> thanks, >> Hi, Andrew >> >> I didn't see the fix for the issue in the upstream. Your proposal should be >> appiled to upstream. Could you appiled the patch or repost by me ? > Forgotten about it ;) Please send a patch sometime? > > . > I will repost the patch as your suggestion. Thanks, Sincerely, zhong jiang