Message ID | 20250107204002.2683356-3-peterx@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E8D7E77198 for <linux-mm@archiver.kernel.org>; Tue, 7 Jan 2025 20:40:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B3DCB6B00A3; Tue, 7 Jan 2025 15:40:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AEE296B00A5; Tue, 7 Jan 2025 15:40:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80B426B00A3; Tue, 7 Jan 2025 15:40:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 56F696B00A5 for <linux-mm@kvack.org>; Tue, 7 Jan 2025 15:40:14 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 17439AFEF4 for <linux-mm@kvack.org>; Tue, 7 Jan 2025 20:40:14 +0000 (UTC) X-FDA: 82981823148.19.279D4B6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf04.hostedemail.com (Postfix) with ESMTP id DF27840012 for <linux-mm@kvack.org>; Tue, 7 Jan 2025 20:40:11 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=P2Vqp4hi; spf=pass (imf04.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736282411; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TCpDisLLwvCIGNbT+PhKKopNoYb0ShL8WntNQkEFj2A=; b=BY8D0T1caVZCC19VHjuVlmCM3d7DumYWayIWJud9B2X6txhA1Dxad/JG6UqNpnBkR+hm6V o/XI/20C9wffNjab6fllw6/fwZ7WK+NzJ7U8rTdgUZCTiZzhqzCXPRWjeC/glD3RunXZ8T 2VfvXLMV0gDyGuoYzUlqAA87H4H7x8s= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736282411; a=rsa-sha256; cv=none; b=Q+ckSMvYHNZ/t7UNQedrAjliIfYiho29BvnZli3au2L6tNafWxpDQXFjNQ54J1Y7ALrxRg wTr/Z7Lx5q7xzNR99+jtVHL2slOklec1Z3clP+UjL3IfJzLneRmprRXSif+WRvxntbPiWR zXDykTaO9UF/hQQ5Ay2b+JEiRuJuzKo= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=P2Vqp4hi; spf=pass (imf04.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736282411; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TCpDisLLwvCIGNbT+PhKKopNoYb0ShL8WntNQkEFj2A=; b=P2Vqp4hiPlJUPtZamfY6+/jaCyFePF49VA8EjguaIl3z7v3OK9yJQb4qVZ9qXihSQhLTn0 +0qIDV39bsHK1QX/3KxCuD0L5hwpiZKvCLrCN4ZO7ZLmRAWOZ/K/EWq7ogle04jvzbWFr5 YX4xnGQVUwyrLI9W3yJZk2PXC+EoM3U= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-491-93O6fbJDPeunrGzMPN8ryw-1; Tue, 07 Jan 2025 15:40:10 -0500 X-MC-Unique: 93O6fbJDPeunrGzMPN8ryw-1 X-Mimecast-MFC-AGG-ID: 93O6fbJDPeunrGzMPN8ryw Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-467b0b0aed4so341169111cf.2 for <linux-mm@kvack.org>; Tue, 07 Jan 2025 12:40:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736282409; x=1736887209; 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=TCpDisLLwvCIGNbT+PhKKopNoYb0ShL8WntNQkEFj2A=; b=W9vnCfv4FbCMfZ4/eCY2X5g2qfN5s/y7j5IUNnDCxehb1nbnJoQA1lCYx1gUqxSnOI BCnWkE0RS7LBkKlXOf3c7kD3jm0yQcB9TfLrnMQQvkISiZ9w1GBk3jE+oRtV+l3fmSQ7 tP0m1t4fe80M1Sps9Fjij5Uy+SyDVkoxXmgNm6NxAv+BQxfiJQFQMpXY3Lz8o8/mnyxQ NpFksSDX2RCEyv48MjUBvKWT1jLuyLJZzgErKaejASxlu64m3abtzJAp9yxtrbyXDaVS d80fine3vPRFotWjBTfyI/WYLVk0DQI1COeMZCZYr50zQQ1igLWU2fVH8WlqpGWDG09i +6Ww== X-Gm-Message-State: AOJu0YwSLHVfjQ+WD8ISQlofydzVq52AvXN8SXAonZYXHfH1vjLQ0x5P uFdko50sFYYYjVye4/5M6Tfi8VsBqv88I3Usmm1B0txq8hn4EMfgW23JbpBybD0H1+Cma1yUTh4 hJSk6iCDRd7Lkllv38ViutbUEkuSQqdDGy1I8/ThbkV0oZeKLvRad2jMosnFE7FsGUIgVX8LynU qw+sLsi42tHyH1vW95SEEjaCT/13ZhTA== X-Gm-Gg: ASbGnctNTHQDZNaq9KqJWJGDTs58WDqk/TnwH2S4bczIVOlo5S+qBOi4P0eAqMjYAG+ kWHzfiqRMujPkXjaPtH0J7ibxRdeEVLRWZmbY+6z7QcD+22jeu/lzbU/bOn2zpSk+bjCh/0waif zae1QRshhj0cWuPNF96r1h3zoUQm95GKtSWt5U++84PtzbT3/lsN5AeV9Jh0SAwS/OFw7aSohxo JEHwFWBnoVVLBndRVyKhnZ4FKoRVrynpW02OF6dW/vvBDW/682t3vLo2JemqcfNxRUoY2ukC3fd FySS7JgiW2RwdF5B2vGVSqSV79cJSCS7 X-Received: by 2002:a05:6214:62c:b0:6d8:e641:da29 with SMTP id 6a1803df08f44-6df9b1cb73bmr8045906d6.6.1736282409218; Tue, 07 Jan 2025 12:40:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsmPVbepwscx9u5TPGeWDqEKCt+YxjZ5PHErDxy3KLOftZYeSvZ9Ie5a+UMBDrcG7IfTLdxQ== X-Received: by 2002:a05:6214:62c:b0:6d8:e641:da29 with SMTP id 6a1803df08f44-6df9b1cb73bmr8045476d6.6.1736282408878; Tue, 07 Jan 2025 12:40:08 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6dd181373f6sm184478306d6.62.2025.01.07.12.40.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 12:40:08 -0800 (PST) From: Peter Xu <peterx@redhat.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Breno Leitao <leitao@debian.org>, Rik van Riel <riel@surriel.com>, Muchun Song <muchun.song@linux.dev>, Naoya Horiguchi <nao.horiguchi@gmail.com>, Roman Gushchin <roman.gushchin@linux.dev>, Ackerley Tng <ackerleytng@google.com>, Andrew Morton <akpm@linux-foundation.org>, peterx@redhat.com, Oscar Salvador <osalvador@suse.de> Subject: [PATCH v2 2/7] mm/hugetlb: Stop using avoid_reserve flag in fork() Date: Tue, 7 Jan 2025 15:39:57 -0500 Message-ID: <20250107204002.2683356-3-peterx@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250107204002.2683356-1-peterx@redhat.com> References: <20250107204002.2683356-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: na9qXYEt3lKDpGhSVMrd5JYro90S0eGfOQ8WpRTr8Do_1736282410 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: DF27840012 X-Stat-Signature: knba16xmdcsggqrit379piy99tf5oghc X-Rspam-User: X-HE-Tag: 1736282411-227477 X-HE-Meta: U2FsdGVkX19BN9zSg0vmTENtHJ94e+Z22DRQ4PWO3E5vygE2G8Y+RMkDnkum+NJQQd6BvvtglNsUlHYJvL4Z/94f1Irg06yLXB9hz55JYvESPxMrlF9gu3ijhbrD3tKgXxkA6XluGaumDPGDHRHMb66Nz4g5SJFx98Sj9XK2KiOYIhjy+wsW83wGCLJ7+7Gba2DGaZQJYS8lgs7dDA0DhKp8y4eMDyiWcdQiE4UsmY72vTmFg5DCf/Ewgkim+vrQd89PPw+/7ot+05himsGHrfbhnnSjWBynWPs49G0ZedbQTsNLfhh6tXy6pV2/bvNfN/nvF4HY+VbPauRcTNg/4a0Hvd8lFZIOrVFF00+KChbevrboBzuXekKOUJKZzxndNG88uE0H38qKNKzdhs4W8cAhpoKYvCe67ZeE00ZRJYJNjnv9Rv+i914WaZwQ5S6/DqJVDpuMldYsTihrJo1maC2+/WoKTOJEVSLc6lsv075cmSlKp4sdsMtFbNQI5SKj7o7AhdUFcCa6r1Q3zXIHEs0IQdUq9UhMkuJrqrYV6bTbwEJMcMyvwqZVw3+UozgVQ+jFh3cq5y1g12Nxr+WDqfwkXgjyv+iZHFecvPh6ZHKltiEEOnheDp1wVcgjSVDfs8kgG6/aAZyjJkqEgqeAdr9TjlSM42HD2S1/dg8+DCF/blQ5jxAX7TW3dqD40Lpi/qSmNPwPrjPNUk7vulhi0Jebr7olxK09llWTKyH/OocjNQwDFzmz35FxGSrgoEVYL9+4bg6ftf7lcxQ1FKhkoHdzPcFtrRZC6ECoBM9DM6/TtWJUZ6TcSXskzbbFlBXhxsi8O/rjjUd2ldcZrcNaol8dOJa+bT7YDOLJT3nhkPlZIpZe3musXkETVVAynFui2GcqF/nTWxRBM6oXv3Vwp9k2O9sMhkkPvE57EdyLGreMPAduMHEBC7QLbC3GdNMzhyONThiZ9lU982kNS15 hs8P8kuJ iQ+CYfYiuSLjfU4FO32sFsfJlEJjzogWnLd1Sp/0iAu7lqnLFv87zIeR5v82tHISqn25YagwwjFMoSttp5XRGePO7dWM5ku7HVdsHknN4Uiul7bGZ6q+qMSRaKlill4MN4c55EUCLaZbFSMBq9ZEU6GJeTZSbHrqwEUUOvBscuBiKQnSQ7nK2pVUtrs04STbFvx1UO6nmQIkh2Ofy5S7NBaUmCr2YtaGDS6D03zjdZLYAeDGVt9eoNHuEKosbhSnCKKtEomx6Z9QB5BczIiw7hU7p86B6ur03xo2owLjxGZeH+Br1U/HMFrWSwV8o2SJVQGqMQ9Aehn17DyrQ1djL8isFvNZCX5mv3ro6UjT1bwhl2VVqEOJfwwKPdR8U246GOJPgXViK0XxKXME9/zYHjWxBBubbUZwv2qEbTY7pkwS4LYXkmwPYDwsQOabPgAoTaRumvFu3HptvCZaH/Kd1uQ5I2bCLWrEqUH4t X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm/hugetlb: Refactor hugetlb allocation resv accounting
|
expand
|
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 2bf971f77553..7be8c35d2a83 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5369,7 +5369,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, spin_unlock(src_ptl); spin_unlock(dst_ptl); /* Do not use reserve as it's private owned */ - new_folio = alloc_hugetlb_folio(dst_vma, addr, 1); + new_folio = alloc_hugetlb_folio(dst_vma, addr, 0); if (IS_ERR(new_folio)) { folio_put(pte_folio); ret = PTR_ERR(new_folio);
When fork() and stumble on top of a dma-pinned hugetlb private page, CoW must happen during fork() to guarantee dma coherency. In this specific path, hugetlb pages need to be allocated for the child process. Stop using avoid_reserve=1 flag here: it's not required to be used here, as dest_vma (which is destined to be a MAP_PRIVATE hugetlb vma) will have no private vma resv map, and that will make sure it won't be able to use a vma reservation later. No functional change intended with this change. Said that, it's still wanted to do this, so as to reduce the usage of avoid_reserve to the only one user, which is also why this flag was introduced initially in commit 04f2cbe35699 ("hugetlb: guarantee that COW faults for a process that called mmap(MAP_PRIVATE) on hugetlbfs will succeed"). I don't see whoever else should set it at all. Further patch will clean up resv accounting based on this. Signed-off-by: Peter Xu <peterx@redhat.com> --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)