Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp385863lqt; Thu, 6 Jun 2024 06:42:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBIvcj7nb8BFWVGsYbQ8wj2u5z9Bjn8Sj21zYGSIe3UmyfatsVDH77sOOHebzpen4WUwnoXyibJKnDihndpCFLo44xrtLwaQtQIIyodA== X-Google-Smtp-Source: AGHT+IFaPudcfvFxdmEPESWjBoeeJe0zaaDCjQI4BDqbpwIBsd3Ca6sNN6e9QnOy7sRbbtTL2yKQ X-Received: by 2002:a05:6e02:1a45:b0:36b:16:9b5e with SMTP id e9e14a558f8ab-374b1f5a4cdmr63634085ab.29.1717681351364; Thu, 06 Jun 2024 06:42:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717681351; cv=pass; d=google.com; s=arc-20160816; b=PBNvwTu2/v3zRb1KCQK1vk8hrwAxMfJVWj4bVcmhoAynfyvxCR6LBCyqN/wy/TWHoF NbDEu/93S0Jj88PtqWt9bxoBHc5Ec+p4Z+C1hyI6t6mEVzCicSIyt9t8B1sv8USCnLRw 0+MZw7vYznBoexKwjiHuJ4NynjNqfrtFjEeU1ru4feeYKpCnjQTNRHWgNRELOz/Ztlcy LvseiKAf+nLZmtcltBmsmX7vpxHKO7y8JgRco37pUXO1+wZlPnKphPAuPMNkDvCBSpan PvNHkmEq+XrszcRhw2yjubxDRVJYbkYcPFchNihE0n15Hcaf5HJkVYGFAL8Uw39+M0Ni YTFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=e2tMmmyBbZeTTofPKQUJgEDsdwhgGJdPHd1pKgME9E4=; fh=EYVkTk/7Jyq3vpFmp8Q/vBTPnOQVR5gmp4fwnPo3QHg=; b=OwJia9Mq4KRm3XDHgQVBpUf/WfO6cUzP6NpDDq0dcMwTOhEr1LwqFh1RYF8F/Kmr0y RPWOcQxZHvrAJhxIrAJPOEFPhYFA67mZS2Y4LDZn7SWdALIvfeOPQN+qlzB9NHYDM6TV 3I3gmugb5BX2AeloTkdtDC6l2igOXoy4zUe4HevD2DaJkTuZlF23HcvJao0O3IsF9ZXC NPcSCTAX7eHm+PkDhib1vj0RcQlp9Wc9xfZp8f5FzOkBKv4KlhWwKoT0l2QycvGRBE/H jPY+ZooIJ6Xf9o0I3r4E75C9L5UsiCI9G6O57do7tdrDd+3hbR6lkcbe3Vrk2LwOwL8A iIDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-204337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de21978fa4si1137082a12.202.2024.06.06.06.42.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:42:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-204337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1A1E5B25BCC for ; Thu, 6 Jun 2024 13:15:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE27C19643E; Thu, 6 Jun 2024 13:14:47 +0000 (UTC) Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DF5B196428; Thu, 6 Jun 2024 13:14:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717679687; cv=none; b=mQcb3FCIMmAqLwJcuEnwvLcJJAIAyMuJjaVh3DDKTD7cnH4E3ZfehahwNzul9vqoYnJ4Hq2m4Dr3L2sC+FV9tzleVfHU8P3pOkHF0W0cGulPZcj50Oni8/NT1xT1Mh3b4vDsvTzHGtL1v4gm9wJQ94331PM8FMft3XoADUG+M2Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717679687; c=relaxed/simple; bh=gp3sNoq6XZoTI5NVdrBYpz34TiddWLflixAGr4p22MM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gr4sOaspVmmmzo01Hpz+0CSbsIMvpvE6lN95Aoqe79lkU90Zz1ytNFAhM7xw+xISNg0faUfK6za4fTKkI4MIyHts+uevmKmAtylIvuLCYw2bq79L3gMGwTEAZp/5b0cXV6NnEJK2ViVAeaCZChb1WBW9i48o20QD/mUzwQlqh9Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=pankajraghav.com; arc=none smtp.client-ip=80.241.56.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pankajraghav.com Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4Vw4YX4BqXz9scC; Thu, 6 Jun 2024 15:14:40 +0200 (CEST) From: Pankaj Raghav To: donettom@linux.ibm.com Cc: akpm@linux-foundation.org, david@redhat.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, ritesh.list@gmail.com, rppt@kernel.org, shuah@kernel.org, songmuchun@bytedance.com, tonyb@cybernetics.com, willy@infradead.org Subject: Re: [PATCH] selftest: mm: Test if hugepage does not get leaked during __bio_release_pages() Date: Thu, 6 Jun 2024 13:14:29 +0000 Message-ID: <20240606131436.592793-1-p.raghav@samsung.com> In-Reply-To: <20240604132801.23377-1-donettom@linux.ibm.com> References: <20240604132801.23377-1-donettom@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > +void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off) > +{ > + int fd; > + char *buffer = NULL; > + char *orig_buffer = NULL; > + size_t h_pagesize = 0; > + size_t writesize; > + int free_hpage_b = 0; > + int free_hpage_a = 0; > + > + writesize = end_off - start_off; > + > + /* Get the default huge page size */ > + h_pagesize = default_huge_page_size(); > + if (!h_pagesize) > + ksft_exit_fail_msg("Unable to determine huge page size\n"); > + > + /* Open the file to DIO */ > + fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT); I encountered a build error as follows in NixOS: In file included from /nix/store/fwh4fxd747m0py3ib3s5abamia9nrf90-glibc-2.39-52-dev/include/fcntl.h:342, from hugetlb_dio.c:15: In function ‘open’, inlined from ‘run_dio_using_hugetlb’ at hugetlb_dio.c:41:7: /nix/store/fwh4fxd747m0py3ib3s5abamia9nrf90-glibc-2.39-52-dev/include/bits/fcntl2.h:50:11: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments 50 | __open_missing_mode (); I saw a commit that fixed similar issues with open syscall before: 8b65ef5ad486 ("selftests/mm: Fix build with _FORTIFY_SOURCE") So something like this should fix the issue? - fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT); + fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT, 0664); > + if (fd < 0) > + ksft_exit_fail_msg("Error opening file"); > +