Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4935350yba; Mon, 13 May 2019 02:20:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIZb5urVV+Ps08TH1NU7tXFgeIegeuP2ZO8D0KYTv+SztrGJQxv/yBmHnZ0A01uGqjVIyJ X-Received: by 2002:a62:5f42:: with SMTP id t63mr6095972pfb.83.1557739217668; Mon, 13 May 2019 02:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557739217; cv=none; d=google.com; s=arc-20160816; b=up+cC/vVBkPW/Irjgdvv3gQorQoB5MZnb2hoMBgKTg8Y9tf7F2VlUi/renpGVMj0Mj qApBnzjqkqJUQ92uhj8sYbsw3UNydBm4i8gLnUU4vyMiPuy/Hu+p9F2R5o9a3YCWslqb dItOD+1BLgeD3T4SIEwx58844zCW2SiDUccYMqu3BmCdneXsTACwZ790SHeE/6uwlsEO B73Uo3aY0I1MgXahNp7i3ewLOEakOqcwZHXZPfFJCGAwYWljPK0Q7yXrgVQVTbyOhjGv zH/w22pa6/gQLBfxf8YuklO9+LjR7QWL0QNWVxjZwxeKYQRrQyz4p+9pCkb3uxG4f2ZX LhJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=aiSC7P6i3DPe9sDdJVZLY3gYyXY/1sYaFRvlo04lPcM=; b=hURJy4Z7l+AnMHF7K+SB/mrpkr84pd/sWZr8P8fLg2ZjL5vP+EAn2DrR4KPqrMexmQ dTrDQra++t86v39Yyf4M5/cmkOyWhX4onN7fC1Juj6Es3zJLY/DVCGubHVaRd5VD86fZ rYCJ9ciyha/Xhvdpaz40OUMzOSczAs+73OjnQlTA19fyAfom6768XeVnffFZGsCQlFB8 7JApK2VI9xBdVZtpOpo71tEuPrK8CviQL0MliBCr+zEonR/ouTGagnMDKtfkjhfrZX+r hrPa1n/59hf6aO6Xh/n3ygq/84tAArG3nFIz61DdJ1/eQBrn2wN6vD4QraMthM/M89bD FMIg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si14798007pln.314.2019.05.13.02.20.02; Mon, 13 May 2019 02:20: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728327AbfEMJPZ (ORCPT + 99 others); Mon, 13 May 2019 05:15:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:57548 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727371AbfEMJPY (ORCPT ); Mon, 13 May 2019 05:15:24 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 38569ACCE; Mon, 13 May 2019 09:15:23 +0000 (UTC) Date: Mon, 13 May 2019 11:15:22 +0200 From: Michal Hocko To: Weikang shi Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: Change count_mm_mlocked_page_nr return type Message-ID: <20190513091522.GA30100@dhcp22.suse.cz> References: <20190513023701.83056-1-swkhack@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190513023701.83056-1-swkhack@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 13-05-19 10:37:01, Weikang shi wrote: > From: swkhack > > In 64-bit machine,the value of "vma->vm_end - vma->vm_start" > maybe negative in 32bit int and the "count >> PAGE_SHIFT"'s result > will be wrong.So change the local variable and return > value to unsigned long will fix the problem. > > Signed-off-by: swkhack Fixes: 0cf2f6f6dc60 ("mm: mlock: check against vma for actual mlock() size") Acked-by: Michal Hocko Most users probably never noticed because large mlocked areas are not allowed by default. So I am not really sure this is worth backporting to stable trees. > --- > mm/mlock.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/mlock.c b/mm/mlock.c > index 080f3b364..d614163f5 100644 > --- a/mm/mlock.c > +++ b/mm/mlock.c > @@ -636,11 +636,11 @@ static int apply_vma_lock_flags(unsigned long start, size_t len, > * is also counted. > * Return value: previously mlocked page counts > */ > -static int count_mm_mlocked_page_nr(struct mm_struct *mm, > +static unsigned long count_mm_mlocked_page_nr(struct mm_struct *mm, > unsigned long start, size_t len) > { > struct vm_area_struct *vma; > - int count = 0; > + unsigned long count = 0; > > if (mm == NULL) > mm = current->mm; > -- > 2.17.1 -- Michal Hocko SUSE Labs