Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp337510rdb; Thu, 5 Oct 2023 07:26:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYF8BraWCrJpXJyvED/GMBCzM4dQWK0MXtxCAwJR6s3uF4uBRd0vlIT0y7RlUTALte/QCg X-Received: by 2002:a17:90b:30cb:b0:279:cea:cfa9 with SMTP id hi11-20020a17090b30cb00b002790ceacfa9mr5232104pjb.21.1696515994473; Thu, 05 Oct 2023 07:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696515994; cv=none; d=google.com; s=arc-20160816; b=abzt9LtonKLuQe9cxjSNteDlxGJraKNwxDFdQcnTcCugWrC/eOOWNH370PeuHZAb3S 40vOtd0C8fIRutiFx3LpbKA0NI66jQWwSZu8a6CYf+p3O0BuYbfqH/9w0DHzHLjcrL6Q D6C/rvYjqGzu3191TyavfeSnkuqL6WwxJ8tpsG9rWKa8UNSuWAGG3gJCFF5cRmFU2YUf 5aI3oXoHcrhlPLufjOhbbzq2xGkltOfHFAGMsaQWkNldJw2igBQ4cD/IkIvVn4A4ppHy XtDMlvglqUzRfSdTFgh88nGabteF+LlQaRTWCv1SK/l8fwDSVIxpfrdyrWe7oO9bsQxP QbGw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Typac5B7OWpGgMVQT5CpmSBuv29OUVSxeeOBcTx4oyI=; fh=fC98Tp/m5J9tA5WyP+frGiFOH49RGNB8LIyJE4ZZ68E=; b=q33AaFnJLRSykXMANTzvmvGiPI/xnQmkliztiz5uwgE/w4hppZMvoPSRYx/eC+fqhi 190edLwqePxz2QcB+/TvvD15QgI5lN+VE/BuNw+Mph0MNMzYfOwi6iwgWbQqBn9l2yP7 SVpdJ4SwKzBd3OZFTpDlCJrl28eKtCeVsvM1Ta6k/twYrRXDWv0B8Y0cbKbcrnKIoOgG Zq4wxVQbt1jaa3HZkF2MNJ0bHrvg6z+865ts4yHS1cWq90j4LVb8VZY1DaGKQPyDkusG D2MFTQBl6JNmGo/l7Sqbj+SSqSWKw3haIXaF5jrZYeiVQQ71f4i1yexcZYUIxOdrmmpn 1Plw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id o2-20020a17090ac70200b0027491bac826si1712114pjt.140.2023.10.05.07.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:26:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id ED26080DB739; Thu, 5 Oct 2023 07:26:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233578AbjJEOY6 (ORCPT + 99 others); Thu, 5 Oct 2023 10:24:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233113AbjJEOWs (ORCPT ); Thu, 5 Oct 2023 10:22:48 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6294A27B1C; Thu, 5 Oct 2023 06:38:46 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9b64b98656bso180272266b.0; Thu, 05 Oct 2023 06:38:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696513123; x=1697117923; h=in-reply-to:content-transfer-encoding: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=Typac5B7OWpGgMVQT5CpmSBuv29OUVSxeeOBcTx4oyI=; b=ZctPJkBRQmDPaOn3Zr5OGfwYd9joLCDVJ5qtyYEmB2D7SWtoxP3q1lwakTrLItg8Bu CuMOJVqeVacvlJHSp+S1IqtTW1NxT7ZqAutjRlesMyR2l2vngkxCg3hN7QIU0GR4i7cM E1FiFBj28S/wvrKl40Uc/KBM5l8BXNL9y9EuhIBNKzqosOZQLBcWBbmG4mhSnsYMx/aX 0HOW9eveTkU5FbVE6XxCKv15ilKWCWu4/1JYZxzcCsOo0qKL8dgQppYYB+M3suY6iQeM cx0VP+99IEW8zEOLus8QZFG+9Fvy8zlJ+8BlZ6Haj/P2A0C8WtnxN8fujo92WTYZqEdB fGwQ== X-Gm-Message-State: AOJu0Yx/sqe8M8tnyFSDBP6Mnt8VBcFbizRSu8kRdD5s05Td6HPwmItm EEVtLZQvzM14E3NDtlicrUM= X-Received: by 2002:a17:906:3012:b0:9a2:225a:8d01 with SMTP id 18-20020a170906301200b009a2225a8d01mr4581177ejz.7.1696513122856; Thu, 05 Oct 2023 06:38:42 -0700 (PDT) Received: from gmail.com (fwdproxy-cln-120.fbsv.net. [2a03:2880:31ff:78::face:b00c]) by smtp.gmail.com with ESMTPSA id kb4-20020a1709070f8400b009adc81bb544sm1210966ejc.106.2023.10.05.06.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 06:38:42 -0700 (PDT) Date: Thu, 5 Oct 2023 06:38:40 -0700 From: Breno Leitao To: Rik van Riel Cc: mike.kravetz@oracle.com, muchun.song@linux.dev, akpm@linux-foundation.org, Shuah Khan , linux-mm@kvack.org, open list , "open list:KERNEL SELFTEST FRAMEWORK" Subject: Re: [PATCH 2/2] selftests/mm: Add a new test for madv and hugetlb Message-ID: References: <20231004171127.106056-1-leitao@debian.org> <20231004171127.106056-2-leitao@debian.org> <026a75f627bc7ffa45ead3fd6ecb9da7b5bc2692.camel@surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <026a75f627bc7ffa45ead3fd6ecb9da7b5bc2692.camel@surriel.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:26:19 -0700 (PDT) On Wed, Oct 04, 2023 at 08:22:08PM -0400, Rik van Riel wrote: > On Wed, 2023-10-04 at 10:11 -0700, Breno Leitao wrote: > > > > +char *huge_ptr; > > + > > +/* Touch the memory while it is being madvised() */ > > +void *touch(void *unused) > > +{ > > +???????char *ptr = (char *)huge_ptr; > > + > > +???????if (!ptr) { > > +???????????????fprintf(stderr, "Failed to allocate memory\n"); > > +???????????????perror(""); > > +???????} > > I'm not sure this error message makes a lot of sense > away from where the huge page gets allocated. Right. I think I don't need this whole "if" clause at all. Let me remove it. > > > > +???????while (max--) { > > +???????????????huge_ptr = mmap(NULL, MMAP_SIZE, PROT_READ | > > PROT_WRITE, > > +???????????????????????????????MAP_PRIVATE | MAP_ANONYMOUS | > > MAP_HUGETLB, -1, 0); > > + > > +???????????????if ((unsigned long)huge_ptr == -1) { > > +???????????????????????perror("Failed to allocate\n"); > > +???????????????????????continue; > > +???????????????} > > Should the test case just exit with an error here, when > the allocation fails? Yes, probably skip the test if we are not able to allocate the memory. I just found I can use something as `ksft_exit_skip()` for this purpose. Thanks for the great feedbacks!