Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5947492rwl; Tue, 11 Apr 2023 12:15:07 -0700 (PDT) X-Google-Smtp-Source: AKy350aqKJUbx+q7PZ1qM7CR19jmnXg6U3Wz02EuBqzKJ8dcZM1j328EPGeLv++DX3m7Yh/AK4B0 X-Received: by 2002:a17:907:2154:b0:94a:98a2:d10c with SMTP id rk20-20020a170907215400b0094a98a2d10cmr3367747ejb.65.1681240507566; Tue, 11 Apr 2023 12:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681240507; cv=none; d=google.com; s=arc-20160816; b=vZbeZUsvLCTbRt4uEAenPX2uvxuszwZUF8LqaGqXeSEeoB1EyQAH+72bFo1UO6cdE2 F3ewj1oAkUo1EsaipIpAyUf8Bvf4rwbrjpWBDgJSFUI5GYhgaCbDkjkEBMuuuFMRRtUv Y/wd/ESXVf73vDdbROwjlRyjJWLCtIwDEuD7V+7gvcnm5aG6ZxuTd4fBHxRV3jb2glGy /b4WrUX+DTRsLm0Zr95MDx7K3yqGdSa7E7EjjerbO9ng+E402yRIINWL9RR+ti86PVWQ /p3h97oPFJxvdIPz/QKdJDT+tKIz6YHQGJ6rVuFP18bfo8ml0YBJkBWTHnkHxuyAUa/E YAIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Z6FiPt73jUvE9HN/xxHQnIU3dr3lCFLdEnuNJPVYshY=; b=TUmo6+gHL7NIDiFCNqQeHag9b7fs+QjPB/+x7E0kCrXqf9XyzLY4aEZhfbqInMa/Fq eFD1Ho8YDy0ZAITQDSqha+Q/r4h0+TbHZrrkd0JAuV328QzTISflsVE049HB1Etczf2+ 9DicJKju1o51L73G63YhMIUZuNdWrP2Kn2weHrqrVVhRtWVBHeVOb0uFuLQgJsphsEbn 4tJdPVUe3+zseujTngxCK1xKcSrwAawJOWa1rXc/XephLN6Yck0LM2sCkdZSBd/uuZKO tJ7TG2sr6ulvbA3Guu63JvKGTb6OtqhpnYd/XYQpRL0Tk3XOlnDjOIY0CKPENUlpRRk4 47dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EA8xy2pW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f16-20020a056402069000b0050492e44c53si8226979edy.255.2023.04.11.12.14.41; Tue, 11 Apr 2023 12:15:07 -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=@redhat.com header.s=mimecast20190719 header.b=EA8xy2pW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229620AbjDKTOM (ORCPT + 99 others); Tue, 11 Apr 2023 15:14:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbjDKTOL (ORCPT ); Tue, 11 Apr 2023 15:14:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7651A420E for ; Tue, 11 Apr 2023 12:13:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681240402; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Z6FiPt73jUvE9HN/xxHQnIU3dr3lCFLdEnuNJPVYshY=; b=EA8xy2pW/K9mN53j+z9HIbRltkmwUOs1JUGPM2v5n6cdOcAbV03oA4pZdMdtyTYnS2+ba0 h7DS23aaSTyPJCkxMhy3VmFnCS7QACJ+gxBctu+Iw1Y3A3i820HMCfKrGCplpjU3kl0mot 3OBJgY2bDKZiY7JoVYEuLV0bYfcelIo= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-157-uljfVgt8OOON4wze-Zjc9Q-1; Tue, 11 Apr 2023 15:13:20 -0400 X-MC-Unique: uljfVgt8OOON4wze-Zjc9Q-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-5e9b05246edso2112986d6.1 for ; Tue, 11 Apr 2023 12:13:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681240400; x=1683832400; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Z6FiPt73jUvE9HN/xxHQnIU3dr3lCFLdEnuNJPVYshY=; b=xK9K8JOwPC7vMTNxmEiSuTZkg8RSofOvMSjXWiSdb/Ymgt+R3K+qtjaeuebgiv6UAj JkWijsItq2fkt+KEg7g0id/YlpLPhtDlJQR7fnX7/+csleHQlgO8+1/yrprgFajAjUQ5 G7iGjF7TqOSzY53YtA8xKYX5TsMtzrHewSfy7ecmqboKEBpNANdPh7rTOomKa2FFX4Rw K3UjfLlziHG8UYgre34IdbojuPv17x4QSQ6ri4C9keYDVByCJGQgBobss3dMe279npPq hvajaDs2UHvKGtGOnJuwVgclzaadM7nYneDovEf/JfL7dF7PNOpEfbRxwq+ADmZ3CHE3 A1xQ== X-Gm-Message-State: AAQBX9e5pxNo1a6avaC6kxavDt4ZHnSufG1EaxFnWFRL1bRhGzjYtp8h jxES2ElTRejoxBm6h1LvFNjSQipl/DHfIJUE8sLX5fg3Jwnx+cEfE38DvmAtOzGDe7FhyOg2gmq XYP7m93K7MvZWM3+AKVUjqyHX X-Received: by 2002:a05:6214:401a:b0:5aa:14b8:e935 with SMTP id kd26-20020a056214401a00b005aa14b8e935mr432354qvb.2.1681240400425; Tue, 11 Apr 2023 12:13:20 -0700 (PDT) X-Received: by 2002:a05:6214:401a:b0:5aa:14b8:e935 with SMTP id kd26-20020a056214401a00b005aa14b8e935mr432338qvb.2.1681240400187; Tue, 11 Apr 2023 12:13:20 -0700 (PDT) Received: from x1n (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id f9-20020ad442c9000000b005e26dcaa159sm4320158qvr.25.2023.04.11.12.13.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 12:13:19 -0700 (PDT) Date: Tue, 11 Apr 2023 15:13:18 -0400 From: Peter Xu To: Mike Rapoport Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrea Arcangeli , David Hildenbrand , Andrew Morton , Nadav Amit , Mike Kravetz , Axel Rasmussen , Leonardo Bras Soares Passos , Mike Rapoport Subject: Re: [PATCH 14/29] selftests/mm: uffd_[un]register() Message-ID: References: <20230330155707.3106228-1-peterx@redhat.com> <20230330160747.3107258-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Fri, Apr 07, 2023 at 02:08:54PM +0300, Mike Rapoport wrote: > > @@ -96,11 +95,7 @@ static void register_region_with_uffd(char *addr, size_t len) > > * handling by the userfaultfd object. In mode, we request to track > > * missing pages (i.e., pages that have not yet been faulted in). > > */ > > - > > - uffdio_register.range.start = (unsigned long)addr; > > - uffdio_register.range.len = len; > > - uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING; > > - if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1) { > > + if (uffd_register(uffd, addr, len, true, false, false)) { > > I'd replace booleans with a bit flags as it easier to read. > Other than that LGTM. It was mostly for no need to remember the long names of macros, and easier when conditionally set with some modes. E.g., we have 5 callers have things like: uffd_register(..., test_uffdio_wp ? UFFDIO_REGISTER_MODE_WP : 0); The bools simplifes it to: uffd_register(..., test_uffdio_wp, ...); But let me know if you still think that's better - I can switch here. Thanks, -- Peter Xu