Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp32444111rwd; Fri, 7 Jul 2023 14:09:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlHLHd/1/a0DrWdW45k4aCWG32DoDEE/1ilVc4ghAPJk8b+YwyfCYq5vExQ1+dpMRWy9aeIs X-Received: by 2002:a05:6402:1a33:b0:51b:df14:594e with SMTP id be19-20020a0564021a3300b0051bdf14594emr4814954edb.39.1688764181527; Fri, 07 Jul 2023 14:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688764181; cv=none; d=google.com; s=arc-20160816; b=oLtrcDGjTikDs3Wq3DJTeLRs4D9hV1dNtUEdujueeo05UkAPwSqEajBij5tux0r5zb aMHxvYN1TB9+jQDNc760IfryPA85OSvQeoAnM1sb8Tok5PypflmALmjfA9jtd1y9dg2t TCZrjCesPKCE4WqR2DaqoJTFwAorgcncsxuCzIW8IQJ5jjQOklCfc8u3mOdzuBj+N2T1 yt0nEhYsm31Oggdh19ug0z0LxXaX+JlMy1GRdOo2HNamsLhJ4TH/3UiaasKu45Be0C2h TN3C1CA5/DJiHCLAeX+YllSGZrZ5daBL6OxqTTYLEbsNpciofigEk/o5UKZOzgiDf10N 5xsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=j5GzoeG98fEPpoz1Cl1g4Qg71twRkm1tM+omwnJ1Pnk=; fh=GZ8AjSm4D/pvo/TqdQfRmssmRrWh0l+thXU+IX781EA=; b=VDTRfFeMzFJAsSGvPfwMZZPN06ypZ58Mcd9pjSEzZX5RwQgUMuEwyBPZ2+6FpmxyBp 4yE7HElDeV7BIoZ00R743fiErpwoxZv1uzMNrvLWUhF5TbbFedPym/eZ9mB09AvaRs1n uyNlxhR8f0VwMFQx0udXPJaEeNYm47Xgsgsa2WMVRrATYatg//wdTkXyRf4a2gxS4JwW ktqmetrvjZmh52A4YaVFtk41FipnXIGtNZDmk4LR2DG6irYyBSteW9hOa52Rmi4W9xuQ iwXsloySz/4ahxLpI+b1aZ39CXc0bHWnQoj9z+pNqPDX6DLWPblKd+ZYnqOwzuRYm4j1 8EXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=WH7E9lv9; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g18-20020a056402181200b0051de2ee33f7si1986900edy.514.2023.07.07.14.09.17; Fri, 07 Jul 2023 14:09:41 -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=@google.com header.s=20221208 header.b=WH7E9lv9; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232404AbjGGUjb (ORCPT + 99 others); Fri, 7 Jul 2023 16:39:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232199AbjGGUj2 (ORCPT ); Fri, 7 Jul 2023 16:39:28 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6D2F2123 for ; Fri, 7 Jul 2023 13:38:54 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-9741caaf9d4so269861266b.0 for ; Fri, 07 Jul 2023 13:38:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688762333; x=1691354333; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=j5GzoeG98fEPpoz1Cl1g4Qg71twRkm1tM+omwnJ1Pnk=; b=WH7E9lv9EnTxKkw+kdIYBI9TKdORaKmjvGgb3pPV847969g1QlrNpJzaggCcNI2bbg h+aTRRezJFDZNa2ZALyMVsdt2NvoXYZGyWbcku/1E36NYHjSECN46W7AD+0oz1803eA4 lzdBpVev9ZPerFAPGyWWO/aHlqgZl1OgHopnYcusk3HaKmwHFdBjqlJcsIoNJzycsTn1 kfnhJVTTNJRQ2wO1kfChdtz/wWwRdt88CkvoYcHmynwgWZRDLPCqtSlJvsAVO5fi2LMu NHRdL3HXNn9cKscccOT7hsBazJ5f0Fua/tERjXEy/liWWxehP1UtUX7sQbJENxFBTTsl H3dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688762333; x=1691354333; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j5GzoeG98fEPpoz1Cl1g4Qg71twRkm1tM+omwnJ1Pnk=; b=kN2Puc762JQMM5BCsxI9ZvxZMnvAFjWtzGr2gCOk4ahAWh+iypZ3XJO8dg4irxO1hM YWTIQcy8eCZeoof8Iab1++sO//OhBiGkErBhlmhJhgBay0T8AhrcaocWjaPreEfl6pif X/eYH5+LyXCV+WGAFleT06/dUbCPTaCxe6A6XgwARPzFztzl4pW1cjtaMn+T5Rxt45Mb JI/kODIj8Vd7geA4TrWZhkwVZxOAPobVRbhT+Nd0A4b9T8aQAUJDwNAO/y5JbxOQheyv XadVxllFob1fm1FcwMySXuwNm2kL8E51+FQIBq/dIMUZi9AE8kkxCJ0tN7AUkGQEkzJo sqWA== X-Gm-Message-State: ABy/qLYdiuA0eE8Y4wSmE2Zb7s38V258TyFaQQNv0eRZbmYQ6QPM74fQ nB6/FgFIQjBXlvrwSAPTPg5iJ+Or2WHneBeb+pZ2vg== X-Received: by 2002:a17:906:1001:b0:962:46d7:c8fc with SMTP id 1-20020a170906100100b0096246d7c8fcmr5864601ejm.21.1688762333216; Fri, 07 Jul 2023 13:38:53 -0700 (PDT) MIME-Version: 1.0 References: <20230706225037.1164380-1-axelrasmussen@google.com> <20230706225037.1164380-8-axelrasmussen@google.com> In-Reply-To: From: Axel Rasmussen Date: Fri, 7 Jul 2023 13:38:16 -0700 Message-ID: Subject: Re: [PATCH v3 7/8] selftests/mm: refactor uffd_poll_thread to allow custom fault handlers To: Peter Xu Cc: Alexander Viro , Andrew Morton , Brian Geffon , Christian Brauner , David Hildenbrand , Gaosheng Cui , Huang Ying , Hugh Dickins , James Houghton , "Jan Alexander Steffens (heftig)" , Jiaqi Yan , Jonathan Corbet , Kefeng Wang , "Liam R. Howlett" , Miaohe Lin , Mike Kravetz , "Mike Rapoport (IBM)" , Muchun Song , Nadav Amit , Naoya Horiguchi , Ryan Roberts , Shuah Khan , Suleiman Souhlal , Suren Baghdasaryan , "T.J. Alumbaugh" , Yu Zhao , ZhangPeng , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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, Jul 7, 2023 at 10:03=E2=80=AFAM Axel Rasmussen wrote: > > On Fri, Jul 7, 2023 at 6:42=E2=80=AFAM Peter Xu wrote= : > > > > On Thu, Jul 06, 2023 at 03:50:35PM -0700, Axel Rasmussen wrote: > > > @@ -247,9 +245,13 @@ static int userfaultfd_stress(void) > > > { > > > void *area; > > > unsigned long nr; > > > - struct uffd_args args[nr_cpus]; > > > + struct uffd_args *args; > > > uint64_t mem_size =3D nr_pages * page_size; > > > > > > + args =3D calloc(nr_cpus, sizeof(struct uffd_args)); > > > + if (!args) > > > + err("allocating args array failed"); > > > > This is trivial, but I think I requested a "free" (or keep it allocate = on > > stack) in previous version but it didn't get a response on why we canno= t > > and it kept going.. could you help explain? > > Oh, sorry! I had meant to change this after our discussion, and simply > overlooked it while reworking the patches. > > I'll include this change in a v4 which also addresses e.g. the > comments on commit 1. Ah, so I tried switching back to the {0} initializer, and was reminded why I didn't do that in v1. :) Ignoring the missing braces warning I talked about before, using {0} here is actually an error ("variable-sized object may not be initialized") because this is a variable sized array (nr_cpus isn't constant). So, that option is out. I'm not a huge fan of adding the free() cleanup and dealing with all of the err() calls this function has. Originally I switched to calloc() because I'm not a big fan of VLAs anyway. But, as a compromise in v4 I'll leave it a VLA, and switch to memset() for initializing it. > > > > > -- > > Peter Xu > >