Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4321467rwd; Tue, 23 May 2023 06:20:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ73+Q71veE9Q+36/GA1PE4wOfjJBN33xa4vgKD8UiiHCs+0rBm89FmIbb5JF2KVnkozhu40 X-Received: by 2002:a17:902:bf06:b0:1ab:1bdd:b307 with SMTP id bi6-20020a170902bf0600b001ab1bddb307mr11958632plb.51.1684848049696; Tue, 23 May 2023 06:20:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684848049; cv=none; d=google.com; s=arc-20160816; b=RbLQNkSPz4j+RJjbXRqgh4WOSLI7UcXHn53qwR8YL4m2G4zNZtZKOCcOjwfFO4s3UR Np/JffCDpYLDfcrtKOPKOOcKQG5gS7Af0FU8KMmHKlXDzY6CI7Rcrr9oGdLpeGMnocYA 9Ylv4DMaJ0O11WpcIDj4bsj9vZHIIF1CslyD/0piQOFPEGoGsQAYUHrnZfcV4NOcPMxm TuXAI2fywVXB0x9GPTARSrvGzvQ6ly+yd1HtDrtL79LzlNVQaQVGeHpgIkjkZyWfJmDR C+hZ9tFioECM9bdU+VGZrJTRwKctmKPrpfOseeTulk1xazEwHBSvsGBrisorlnleyks3 8GwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=bgL1MIRZX3Y+FVWSNOkU++9NMPuYvd0QkuZ4FyLBVfU=; b=UfFpC7PPDXPb0RYovglMy4TFqYI/tRyTY3xZupJi1M5+M5o0w9jZ13ZLnF6EWKZySz s2ju8BextVKOigokYZZYOFOCkQsdYiS32WEn++v5pupx9Yu4vtFZQHD51HcG/XQer5lD enZ1plxd+Faig67aCEjfv+UQ/cMVEIATWAAa/RaLHoZYQ+hiB3iJIed6lV4zxASajYf8 QdzyYOff+41Nc0deeQSbPJ0FbXDizbKrhqcyj3gKq+T7XmLAwa8qC/K6mlTvDbKT8IkW 16+h4oyWDU4IQQet5lZp+BUFI7Bw8rTRHq0xhaRNOXf2/QEI5rN/HLWA/qBNLQ54aaud DPZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=EEwAnJIe; dkim=neutral (no key) header.i=@suse.cz header.b=Xv3rH11f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw1-20020a170903044100b001a63a7b7025si761038plb.30.2023.05.23.06.20.37; Tue, 23 May 2023 06:20:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=EEwAnJIe; dkim=neutral (no key) header.i=@suse.cz header.b=Xv3rH11f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236750AbjEWNNz (ORCPT + 99 others); Tue, 23 May 2023 09:13:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236720AbjEWNNx (ORCPT ); Tue, 23 May 2023 09:13:53 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39996184 for ; Tue, 23 May 2023 06:13:45 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E931E22AB7; Tue, 23 May 2023 13:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1684847623; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bgL1MIRZX3Y+FVWSNOkU++9NMPuYvd0QkuZ4FyLBVfU=; b=EEwAnJIezFPmi/jB0fiajqlAZJHIaxDV0zOANdyOK0hO689bBOzb/mtstSMAicqCiLWpgi VWoRDfh9JktX8kDoVzhMX+5Z7Yhu0Y3fuI6S5Upzq2H1mcROy/h9kdyzxNLHX6CGYpdroW q+ItsLN02lg13wI4KBgfd1VsfG5wYK8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1684847623; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bgL1MIRZX3Y+FVWSNOkU++9NMPuYvd0QkuZ4FyLBVfU=; b=Xv3rH11f9CNEqWknjeqH8ehvmD/QHsE90UXWMIa04KXsgEt4haFtk2+5bTJJ9k28zp5kuR GK2i3+MUcqaFjODQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CF16713A10; Tue, 23 May 2023 13:13:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6ojXMQe8bGTUPwAAMHmgww (envelope-from ); Tue, 23 May 2023 13:13:43 +0000 Message-ID: <856dbc05-5046-04c8-cf6f-9d0b13e9d229@suse.cz> Date: Tue, 23 May 2023 15:13:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] mm/mmap: refactor mlock_future_check() Content-Language: en-US To: Lorenzo Stoakes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton Cc: Mike Rapoport , "Liam R . Howlett" References: <20230522082412.56685-1-lstoakes@gmail.com> From: Vlastimil Babka In-Reply-To: <20230522082412.56685-1-lstoakes@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/22/23 10:24, Lorenzo Stoakes wrote: > In all but one instance, mlock_future_check() is treated as a boolean > function despite returning an error code. In one instance, this error code > is ignored and replaced with -ENOMEM. > > This is confusing, and the inversion of true -> failure, false -> success > is not warranted. Convert the function to a bool, lightly refactor and > return true if the check passes, false if not. > > Signed-off-by: Lorenzo Stoakes Acked-by: Vlastimil Babka > --- > mm/internal.h | 4 ++-- > mm/mmap.c | 33 +++++++++++++++++---------------- > mm/mremap.c | 2 +- > mm/secretmem.c | 2 +- > 4 files changed, 21 insertions(+), 20 deletions(-) > > diff --git a/mm/internal.h b/mm/internal.h > index bb6542279599..66dd214b302a 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -576,8 +576,8 @@ extern long populate_vma_page_range(struct vm_area_struct *vma, > extern long faultin_vma_page_range(struct vm_area_struct *vma, > unsigned long start, unsigned long end, > bool write, int *locked); > -extern int mlock_future_check(struct mm_struct *mm, unsigned long flags, > - unsigned long len); > +extern bool mlock_future_check(struct mm_struct *mm, unsigned long flags, > + unsigned long bytes); This would have been good opportunity to drop the extern.