From patchwork Mon Feb 5 19:18:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 197004 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1149634dyb; Mon, 5 Feb 2024 13:15:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdhMMFW4cRof71kVNL9xamONPgW1NMH2kBcwqrMOBkEfNqAaLjM0mxuTVj49wk5EiYXeAc X-Received: by 2002:aa7:d7c7:0:b0:560:617b:8b01 with SMTP id e7-20020aa7d7c7000000b00560617b8b01mr314315eds.28.1707167740514; Mon, 05 Feb 2024 13:15:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707167740; cv=pass; d=google.com; s=arc-20160816; b=g+e7zxoCisJWqj/SW4P/bp7uOMnDuk4VoTKD69cSStR8cLTg9b8sCLg46JcOpDllYu dUfHa7woha/OPV6WBz3z7W1GNB3t4UaVYqns/9cm26H/OVwU/sGZCWuTNx1bar297UlK uQfw+ecIuHerWoHxHihoeLkutjUvYeBGfuzlrWoiQwVTFNtMukV+uHQ8TBkWjIlq6J4G 4r+zAMqjm1dLiPHCdMgytSCHXmnh4PGTHb81eVYvRhBRhB51b/TKiy2SBpXmrvk8xtam ct8gX+wWmo00rR9Co55qy0v3J3U8CBgYNRYH/0FksTj4rk4MtiZjKP/X52arTzeZ9Q7e 4yMg== 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=7YfrI5usOrBhq2NBpdCHSIDWPFSL+4qU1L11CadSm6A=; fh=G/XLsDSEEI8BJcRaTTiL05egYPwdaPCHmZkZQiXQhzU=; b=Qo31H4fh2WQMnwpRJnLteFrEzpm7RgZ3Y82wj4lxPUGSusA2b9yYdoe3Y/ICYn5vk3 xNTQr3ze3zLNfqg5p+nj90Prv5CJ8na2nps8hY/ZgzyuIlqSpz+mqYAG2vWkOMyv6V/U F/FXuGvzewbLPxuvMKj4QngI8tFbUy5pT3oKEwI2Aq1u/IHh3a6vIvfvSxF97txOTIuj ltyA9ZjsHg0dXED08JCfhjozt80CfgAGYGXNdHD8xvhBAgOoReqMvyJO9qn5fbsJVuzC Ao6mS59/Xb9OIgpItVBuq0SX24R4x7H6IjMLdfN3mNKDE/z1795B+UqepwktJYEL3bcU 2bCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-53809-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53809-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUpaRSiQ/0LYK2zeGlIn/NYtTZWbUr/kFH06ahTCMototTjRTXcd/nTZdvC+amryJ7C5pWLDw9I7nUHXzrf8Xh1KFK4rw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n9-20020a056402060900b0055f7d6be6f2si304335edv.152.2024.02.05.13.15.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 13:15:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53809-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-53809-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53809-ouuuleilei=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id EEB521F28A62 for ; Mon, 5 Feb 2024 21:15:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C5025677D; Mon, 5 Feb 2024 19:19:07 +0000 (UTC) Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7E9A54FAD for ; Mon, 5 Feb 2024 19:18:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707160743; cv=none; b=t3G8XVNGjjLp2jelOJOBXcOZMZTK88Jm6gr9VLNHWktjjs9vFeWQ3DhVK0vJZ/GrZR6c/57/rfSctvEWh2AfZIDB/1FdkTq/HRn5/Yqh2c3+rAFINYMsrQPx4N4zTsgvhCnBXFryq7Mh6k3DFFxy00plHjmHYGKJlGgZ+Apw+V8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707160743; c=relaxed/simple; bh=lNsOXfwBd5Jg1UhnYbBG016w4D6gifAwE1Om4ooiUaA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HZMF/j2SVnEu4Fi/KJPnk9aIPYtMeBlgBlnqOQBgKCvhblysTq1vrIHT8viTJwEIgSwXv3VYltyxc0gFKFl3TAsISqQe/hzuY0Uq9IS9jyswen4D5P61KurMsTirT9PpDnyrqKvSG/zpkzW6FmrTKmgQMKnQq1vZbHyTnxWcQik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-55a035669d5so6840048a12.2 for ; Mon, 05 Feb 2024 11:18:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707160738; x=1707765538; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7YfrI5usOrBhq2NBpdCHSIDWPFSL+4qU1L11CadSm6A=; b=q/DzHxx93FTlg22LGbVc+BqK5LvklxMEXEIogvuoyncWWocL9f3KyGYDhG4Lvy5tfP DLdOOQpRTFtqDQmy1Y7Sv1q7hVZetzDpjSsxzzhPslS8F6LWtd5FmbnHRqLMQk40/GVn XHVi7p9B0Q73AqFahfjdQTwvX2XJoL6MsmFdtr4J9pYNNQpTXCB+t/LnuyC4dvrpfOIB kFOdWLRUJKk9Pq/bm9MFZaoen1RuOsogwqeU3U1Fvo0BdlGArW2sSz3882Af8xLuIpy9 zkPZoKApvVI3rmlRa/5srZ/kvxIsnD9DMOcQFO8Syr23OstADrkMdN/fh/UI7Ng0zbUd /oAg== X-Gm-Message-State: AOJu0YwM7BgfiRMyBlZL4FoKoxeu5B2Roy96bgvWHtwLOMG40zkHVeTE agI6TybYVT13PfpxDeuGkzPVsWJNg+M6YDVQvEB5SFYbSPfC8uk8 X-Received: by 2002:a17:907:7746:b0:a28:d1f9:976 with SMTP id kx6-20020a170907774600b00a28d1f90976mr228274ejc.65.1707160737874; Mon, 05 Feb 2024 11:18:57 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXVm5RKPt+Hlz22NnQj7TZfmCmCPsU/XvEaNZ9YvFqmT9hiTOEBxbGNZw9X7DUtafu4eEfhaq4K6nUvuLarSkrwmFkypvNZGY7hG96yJ7PZzbhjJLZtnmzXOjqjEQrp5aPiBokhkMhhB+dDl40ykJWzz4TeDugPTAoqJy4oRsQdUAiyiMpxskMZnvCEJLgVgWHWUpMb0kUD6GNkKfx97LTrv7PzZIWgemoQZ9XX3oX1jL7wXkGnMuJesFH0OUtC1S74UkOpFrdBMgKDHDmUuuWS4PsAOYHq/7o9vAVwvNpkrvZI9hK79X4KJPuwIP9BKcVJr2B9i0CxaPS8 Received: from localhost (fwdproxy-cln-021.fbsv.net. [2a03:2880:31ff:15::face:b00c]) by smtp.gmail.com with ESMTPSA id x15-20020a170906134f00b00a372b38380csm167637ejb.13.2024.02.05.11.18.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 11:18:57 -0800 (PST) From: Breno Leitao To: mike.kravetz@oracle.com, linux-mm@kvack.org, akpm@linux-foundation.org, muchun.song@linux.dev Cc: lstoakes@gmail.com, willy@infradead.org, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, linux-kernel@vger.kernel.org, Rik van Riel Subject: [PATCH v2 1/2] mm/hugetlb: Restore the reservation if needed Date: Mon, 5 Feb 2024 11:18:41 -0800 Message-Id: <20240205191843.4009640-2-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240205191843.4009640-1-leitao@debian.org> References: <20240205191843.4009640-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790095121057389693 X-GMAIL-MSGID: 1790095121057389693 Currently there is a bug that a huge page could be stolen, and when the original owner tries to fault in it, it causes a page fault. You can achieve that by: 1) Creating a single page echo 1 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages 2) mmap() the page above with MAP_HUGETLB into (void *ptr1). * This will mark the page as reserved 3) touch the page, which causes a page fault and allocates the page * This will move the page out of the free list. * It will also unreserved the page, since there is no more free page 4) madvise(MADV_DONTNEED) the page * This will free the page, but not mark it as reserved. 5) Allocate a secondary page with mmap(MAP_HUGETLB) into (void *ptr2). * it should fail, but, since there is no more available page. * But, since the page above is not reserved, this mmap() succeed. 6) Faulting at ptr1 will cause a SIGBUS * it will try to allocate a huge page, but there is none available A full reproducer is in selftest. See https://lore.kernel.org/all/20240105155419.1939484-1-leitao@debian.org/ Fix this by restoring the reserved page if necessary. These are the condition for the page restore: * The system is not using surplus pages. The goal is to reduce the surplus usage for this case. * If the VMA has the HPAGE_RESV_OWNER flag set, and is PRIVATE. This is safely checked using __vma_private_lock() * The page is anonymous Once this is scenario is found, set the `hugetlb_restore_reserve` bit in the folio. Then check if the resv reservations need to be adjusted later, done later, after the spinlock, since the vma_xxxx_reservation() might touch the file system lock. Suggested-by: Rik van Riel Signed-off-by: Breno Leitao --- mm/hugetlb.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ed1581b670d4..44f1e6366d04 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5585,6 +5585,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, struct page *page; struct hstate *h = hstate_vma(vma); unsigned long sz = huge_page_size(h); + bool adjust_reservation = false; unsigned long last_addr_mask; bool force_flush = false; @@ -5677,7 +5678,31 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, hugetlb_count_sub(pages_per_huge_page(h), mm); hugetlb_remove_rmap(page_folio(page)); + /* + * Restore the reservation for anonymous page, otherwise the + * backing page could be stolen by someone. + * If there we are freeing a surplus, do not set the restore + * reservation bit. + */ + if (!h->surplus_huge_pages && __vma_private_lock(vma) && + folio_test_anon(page_folio(page))) { + folio_set_hugetlb_restore_reserve(page_folio(page)); + /* Reservation to be adjusted after the spin lock */ + adjust_reservation = true; + } + spin_unlock(ptl); + + /* + * Adjust the reservation for the region that will have the + * reserve restored. Keep in mind that vma_needs_reservation() changes + * resv->adds_in_progress if it succeeds. If this is not done, + * do_exit() will not see it, and will keep the reservation + * forever. + */ + if (adjust_reservation && vma_needs_reservation(h, vma, address)) + vma_add_reservation(h, vma, address); + tlb_remove_page_size(tlb, page, huge_page_size(h)); /* * Bail out after unmapping reference page if supplied From patchwork Mon Feb 5 19:18:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 197015 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1155137dyb; Mon, 5 Feb 2024 13:28:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGh79GCB3So9PwEarIv6F4i2l6grwjahRA8ZllFWi9yRZOhMjBIKmKr6sKXSNtVhKuchBNz X-Received: by 2002:a17:902:ce92:b0:1d9:7587:8298 with SMTP id f18-20020a170902ce9200b001d975878298mr11491089plg.23.1707168533066; Mon, 05 Feb 2024 13:28:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707168533; cv=pass; d=google.com; s=arc-20160816; b=faSBgig/n5lbbA1vu/rSV1xi3eTE3Q1G6DACOxenpri/WAPocw3B+Nu6o/iIQPPB75 V2yGOZ0rO/yVhS/mOgHhZEXWZFc8iywCC8DMHuFW4c9nu5i83Xl3IOnTnPvSogpScntQ 1UJWCsX1WzTcC8JzRs0DTKx0zb9NVtL8UYBCzpViNIDkgyf/kyDmHCjSVfUOGrZyQs/Y Eb/LFk83a/D4YdGx1509KDLgPWzT+3qCYJzK6VYMMMyrHtfryMpWFVjp3mF2IIOfapDj ziMv/8nrPHNTl+EuI85nXgReeFC6SI3wGZR7MBRN/m8lHofXfa9/E2NbryoVO/PpWfNL sKDA== 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=/WC26n55iZnXbww+34MstvyMYAWzNyFy0JnU0QygjqI=; fh=sA72F9MJyqabpIRosxs7zMTLISZHbWKfmeVmmljRqII=; b=KssrRn3JPBiu//4yNwYPvpLosDCTgc16WWHwxta+awFMeGNAcfR17rCoxvnnuKxK7V byKhF0JS9UW3HlZSwnu8Wl8TOqmJzWUJ3YdFdoKFWEeMaS1+M0xgqbS1BJ/QCBPyBAXv pWZIevRE2wNLs1Q7NtgWSQcYKB4YhsjlF7Z8UPMcY969yEXNaruCPbeR9kIg4ttOKRZk KDnSTMMnlKI0cTt3ODLDESoGuAIeOUamYnNQCA5yP4SM8DCWFiCdZF4bHh5oRxDA6lsB dDSj4DfDpSMR3WgRrN+9+LPacN+M4+q76CNw720gmOi4uAxSAcn4c4jzXQlTsImS+/Xj km7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-53810-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53810-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXQMFgRhkxIPk5PZKAacHuC4qNUBPlSen/Y+ZQgqoyPxi+mb9lKnwyt6tr5aWXk+hEdYKgqpZsPFObEjhZ1FNpALYKz3Q== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 10-20020a63164a000000b005c69365abbbsi460193pgw.318.2024.02.05.13.28.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 13:28:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53810-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-53810-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53810-ouuuleilei=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4A9E2290125 for ; Mon, 5 Feb 2024 21:15:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B98CD56768; Mon, 5 Feb 2024 19:19:06 +0000 (UTC) Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B88AA55C1D; Mon, 5 Feb 2024 19:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707160743; cv=none; b=Alk0OKZ0dqJAHKI7I2QFO/zPHl2Yhg4Es5GR/Dvg9y6Wym2IaPlxy/3zUe1i5SHK5B2D/s+6XzVZXpgQI6BhIKma3nUF2PN+xK/jtvvZReFAw4z+cr5wDP1z31XWUimYDS5i9OiN2PBkWhjVj9aji8EjDpmb5cde+/eSAocgfxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707160743; c=relaxed/simple; bh=ncRsIdJWU7Fb5w1Y11uJGyPE0DAbtzrze6NkIJGNx7s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SIWcp5Vdk6uCo/dl0x6vkUUb/ZgED9zZHjgAyHND4oj3EDWZcp93Vu/Uw8BfnhPsZj6YNg+ifHM3uvjh7tru4ewLH0hJS0xB4Vsni+k0z7Y0KH89VX1LsPFEuiBzjQGdqshROQ6o74aagYXuZ95bdLsFFcHJ20EKDuSBVBWUh+k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a359e6fde44so3831766b.3; Mon, 05 Feb 2024 11:19:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707160740; x=1707765540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/WC26n55iZnXbww+34MstvyMYAWzNyFy0JnU0QygjqI=; b=fRNVYTUm1EGmkbd5wiEjURxZgyrmAsXeTVzUBylB3K+cPpBynSKzqCyjOOVzW4Iv4w DPstoyI1oPat+xWOb/SDzT9I/Liy7W0FTo3Zayp2RYYEtwVxOjJqzA0c+94NIdT6nEbV qPKLzPh8UKE/GjL1kPQFPHaob/eaDMnlMQDdr68VGtBF6lkL8e2P2Y+3NJ0+It8/72zK XhU0wo3bHCBSRyFXoU0ZzNN+D/jOkjwvJdgGDXYbauVJUFpnCCpW2cxNr8kc4TWn1XLg ppq9i7IEvh9mE928TnQ5oTdw/X1bkxS9HLlNd/e3MSVY3ueZaDVBc3+PGGWC79nsJ1+b y93A== X-Gm-Message-State: AOJu0Yw4Koni2auFpfRXqmWlTPyuBONPcnAjMIoYUJJWJzuhAEgDzNH3 drEy8ntJ7TC25UwEdH3iXApdthOFPs41IW6fDyNMOKUA9LyLpeZJ X-Received: by 2002:a17:906:2456:b0:a37:aa39:ea27 with SMTP id a22-20020a170906245600b00a37aa39ea27mr270002ejb.65.1707160739532; Mon, 05 Feb 2024 11:18:59 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUnz2Sd1sNKTlh9XUDSn65VAeg6JyD3s7WLIQ/AfZVc3isM/4jwLTT3rCz6D3aOibuSJbNxTV7xdKsyzl43Jl7nwofsacO+7LrqvYEhR0j/SSA/edgIrR9eynGCSYOZldjwSA11NMQiyCmWZJuBLEuTr66gcE+P7xNWzxcKrQo9yuRIANDY3QaLwr6mtiyuFu1CgPqSvlN7mM8gzwRyEM0TBls1KHITRga7eCqYyEOnsQpel/UgZ9zD7Vm/EY9bO2yHahpVWGtWfPGZ7rkiCEFzMNHm4ia7CWCiGPu/tf3zl9LI1n4odRGBVzdW/dpNiHxhM+J/RkIllH8jstVP5BbLt5Kyk5Ti/IZolE2vlpIaPmq7U0tonZ3nm1Ch Received: from localhost (fwdproxy-cln-018.fbsv.net. [2a03:2880:31ff:12::face:b00c]) by smtp.gmail.com with ESMTPSA id qb12-20020a1709077e8c00b00a373993b390sm156733ejc.148.2024.02.05.11.18.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 11:18:59 -0800 (PST) From: Breno Leitao To: mike.kravetz@oracle.com, linux-mm@kvack.org, akpm@linux-foundation.org, muchun.song@linux.dev, Shuah Khan Cc: lstoakes@gmail.com, willy@infradead.org, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org (open list:KERNEL SELFTEST FRAMEWORK) Subject: [PATCH v2 2/2] selftests/mm: run_vmtests.sh: add hugetlb_madv_vs_map Date: Mon, 5 Feb 2024 11:18:42 -0800 Message-Id: <20240205191843.4009640-3-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240205191843.4009640-1-leitao@debian.org> References: <20240205191843.4009640-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790095952002765888 X-GMAIL-MSGID: 1790095952002765888 hugetlb_madv_vs_map selftest was not part of the mm test-suite since we didn't have a fix for the problem it found. Now that the problem is already fixed (see previous commit), let's enable this selftest in the default test-suite. Signed-off-by: Breno Leitao --- tools/testing/selftests/mm/run_vmtests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 246d53a5d7f2..50e2094ed761 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -253,6 +253,7 @@ nr_hugepages_tmp=$(cat /proc/sys/vm/nr_hugepages) # For this test, we need one and just one huge page echo 1 > /proc/sys/vm/nr_hugepages CATEGORY="hugetlb" run_test ./hugetlb_fault_after_madv +CATEGORY="hugetlb" run_test ./hugetlb_madv_vs_map # Restore the previous number of huge pages, since further tests rely on it echo "$nr_hugepages_tmp" > /proc/sys/vm/nr_hugepages