Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1443imm; Mon, 2 Jul 2018 06:43:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfApzZNaPWLKnAIWM3uqTmicm+eWwvmcqbvDCQoJ8Lq6Pss2k9Gj2mnjbJLAKJDJ6XVuJIS X-Received: by 2002:a63:db05:: with SMTP id e5-v6mr12750205pgg.152.1530539004473; Mon, 02 Jul 2018 06:43:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530539004; cv=none; d=google.com; s=arc-20160816; b=Vf/7Qv/wL2fdHGkz4Ap/hDlvpt6E7GJ+bFjhE5G3FXwHm+4yfZKHwS1oIpoN/yQgc+ Dq79JYSJ1PeqvsUmyVJ7EVKVh03yfn0nqCh47mVLB7HMOrbjSYcvoS3V+YqXXYsDS0a6 mrEONjXI2IEqhzDB9HETXKgRFCWZC5AxdOBWaW+oysYkYSMY/L4ZVptiu+W98KwCo8S9 yvN5gSrTWKqetTycjjk/mNXDb66WaWZzAm/3cDHB+6lVTC9yERPWFGcj5XpQ2UD/cyxy Mq0je0k0nnm/UE11dFyrzlykYf0TZ5JbXIDnDMwaI2Df8A6h7cMLj9iFFS93gpQmWdml qCjA== 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:arc-authentication-results; bh=oHsKeRdmsS73vNNB7LoQ2jg2oRMJIvUX2z2wCD8YIaw=; b=eQaj9X/tMxPJ8sBO43LC0ZemzPADjspjirIw+VEnAcLcc6n3Ve27OIS5m6/T3u/UyI YRzlMzkh7ysYv/TCp2CN1CwDTGKwl5K74ru2GsOU1Bjeyet4n1aR96aVHCl955WCKJWX 7uJNrkZplWJeBpL7uIM5nImiyHyBRwOJpApYfpvrPPhAOpSh7gPyn8++kmSgchaFcjNZ l3/Z7ocYR83IIwhLMEnzd1pLZb1ioy5jotrofOAX9QB0xwCo3XSPdzYPZz7Jz+sTebhh srhLavDKmndts6dySkZSg+/abB4qZzdObp1Zfj32FIQTSmCTrdOLYn6OeD4+fH2uJTjU ouNA== 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 i9-v6si14079947pgp.568.2018.07.02.06.43.10; Mon, 02 Jul 2018 06:43:24 -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 S1752636AbeGBNma (ORCPT + 99 others); Mon, 2 Jul 2018 09:42:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:46422 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751878AbeGBNm3 (ORCPT ); Mon, 2 Jul 2018 09:42:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4405AAD26; Mon, 2 Jul 2018 13:42:28 +0000 (UTC) Date: Mon, 2 Jul 2018 15:42:26 +0200 From: Michal Hocko To: Yang Shi Cc: willy@infradead.org, ldufour@linux.vnet.ibm.com, akpm@linux-foundation.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, tglx@linutronix.de, hpa@zytor.com, linux-mm@kvack.org, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC v3 PATCH 3/5] mm: refactor do_munmap() to extract the common part Message-ID: <20180702134226.GX19043@dhcp22.suse.cz> References: <1530311985-31251-1-git-send-email-yang.shi@linux.alibaba.com> <1530311985-31251-4-git-send-email-yang.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1530311985-31251-4-git-send-email-yang.shi@linux.alibaba.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 30-06-18 06:39:43, Yang Shi wrote: > Introduces two new helper functions: > * munmap_addr_sanity() > * munmap_lookup_vma() > > They will be used by do_munmap() and the new do_munmap with zapping > large mapping early in the later patch. > > There is no functional change, just code refactor. There are whitespace changes which make the code much harder to review than necessary. > +static inline bool munmap_addr_sanity(unsigned long start, size_t len) > { > - unsigned long end; > - struct vm_area_struct *vma, *prev, *last; > + if ((offset_in_page(start)) || start > TASK_SIZE || len > TASK_SIZE - start) > + return false; > > - if ((offset_in_page(start)) || start > TASK_SIZE || len > TASK_SIZE-start) > - return -EINVAL; e.g. here. -- Michal Hocko SUSE Labs