From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 152B4C02180 for ; Mon, 13 Jan 2025 16:19:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A33566B0098; Mon, 13 Jan 2025 11:19:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9BFAF6B009C; Mon, 13 Jan 2025 11:19:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8027B6B009B; Mon, 13 Jan 2025 11:19:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 58C3A6B0095 for ; Mon, 13 Jan 2025 11:19:39 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0C9551C6BF7 for ; Mon, 13 Jan 2025 16:19:39 +0000 (UTC) X-FDA: 83002939278.27.2BF7CD7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf06.hostedemail.com (Postfix) with ESMTP id 9FE98180015 for ; Mon, 13 Jan 2025 16:19:36 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ipAjtkxC; spf=pass (imf06.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.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=1736785176; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IDkV1rDSOYmAm8RJGxE2x5aaSSKCEneZP3d7jqhBPY8=; b=aiml7XWEXOd+7ePn84lwqODk+Pz6a4N2xdx68R2FTGVbBwEV7/n1ULPTNHBl1IaZXPDMzr Y1YxhaIGt8O+idLNpBiJQ2Qy2sDRZQLQq1oz2sBjGVeT0X1w7cVzZnkrOLI0iYQEBzNd26 vqXIAGxvO7ew7GVm4XTYXd/I4a5z/Yk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736785176; a=rsa-sha256; cv=none; b=xAql7EaDv/Ae/yUtYEw1JFVQxkY4a6F6N2J3fd0yoZF/yvLziFaAfIFHmpAapMYtp7Nyjp RorMdhTAnyyZf8LwGTm8Br/xS9Ays96C9Wyk6bH/kPNFdv/a6J3u5JPMjtUWEgT4Xmp24H MBXEWWX+tc9MtkpVMzEOfOn4w9wfMbQ= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ipAjtkxC; spf=pass (imf06.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.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=1736785176; 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: in-reply-to:in-reply-to:references:references; bh=IDkV1rDSOYmAm8RJGxE2x5aaSSKCEneZP3d7jqhBPY8=; b=ipAjtkxCC0Y03biZgm0cnSvdltG67cZwoSOvGWzpZ8H5UeE5ocxJ15jdzTUHz3B6q9rq8N g3o2a2eYgQ51ZCWAcgOc9wZXlITSak5QxvqEJH8Q1ftBPKqVHn0cej7NtnGAKZlyqx89oY 4snDK7ZDVY1O82iy1bwV5eELnufB3g4= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-364-oIN1nqzvPc2nDgd-2VuZDA-1; Mon, 13 Jan 2025 11:19:34 -0500 X-MC-Unique: oIN1nqzvPc2nDgd-2VuZDA-1 X-Mimecast-MFC-AGG-ID: oIN1nqzvPc2nDgd-2VuZDA Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2164861e1feso76900135ad.1 for ; Mon, 13 Jan 2025 08:19:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736785174; x=1737389974; h=in-reply-to: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=IDkV1rDSOYmAm8RJGxE2x5aaSSKCEneZP3d7jqhBPY8=; b=llxltqpmvk7DyC6nhxIdB+/BAPc1U58G9V34o8QFEfL71OJ1vfN5UGZ/8IVcCB50H4 8/ygW0x8HxATzFVMVKgV1KavVdHiASBtNS5jgFcW1dDCNjRUjo71sTSBubzqLX50bqEG 1ei2fk3N2N1F/8f1uxzo9HfhnrctTwLFxJWspweqH7Nm3KAml/mCkmxfcjYqIgwDpWlQ rjmxpkLUaNNl7SJhfS8Ac55TEBDdi6SBy4Z/yy2cqUMOH4/uRn+gw1XmfAzCCgYNhmmZ pXtPAUhFaOxiR6zs2BHm7KafZuVm+e2poeofE+Z4oRSIajv0w2t/dIiwme8pqt8ow7ve NpsA== X-Gm-Message-State: AOJu0Yy6iK85tATMOpULE1XlB0/pLEbrlcnTJpCq38ygxDnc7py1hykX zS7oSFEo9hBy6QCpvK/Smn4Qx38hOGvxOgWQ0CvAN35nd/lAolboVi7Z07LTJqAReFRbbb5naWB AHd2M+k3nLyEH9zQEWhBw6vRxsGJD40A2VTJDtNwqg0PjoCR4 X-Gm-Gg: ASbGncvBw7HAbskP8LZ28l8BwzDFApBJLxhfdttsc+69HwV+vQIBZDFeRLLF46GSE2W DcGLPZ0K46rZgg7HBne6XkuuzZQna50Hy+g8pOGZO49RxPZ3Zuu9fDZ9Dwxm8JLkUGpA/Ovm2gQ NpHOnf43H2BrbzoEArIwvENOMVhU+5/xdd1xpiqs/1DUEdxsdX/5biru2XVvtoIRPilgi7xObG2 AjJs4WlV/iktrUD+rlTg6R4/c1TyaT8UNh2VFV1QyVHtP2cTHP9tDC482IOyxqDHWyMfpbV0Z/+ DTDse1NgW7Iv59XP3w== X-Received: by 2002:a05:6a20:9c8d:b0:1e1:af70:a30b with SMTP id adf61e73a8af0-1e88d0bfa31mr41021650637.34.1736785173782; Mon, 13 Jan 2025 08:19:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7f7ZjP3Dus301GWs4eZ6h8/R/3+H6waRmZqFuSic1aNEpNhpwa0Db6ehH+Pt725zAU12rVQ== X-Received: by 2002:a05:6a20:9c8d:b0:1e1:af70:a30b with SMTP id adf61e73a8af0-1e88d0bfa31mr41021617637.34.1736785173470; Mon, 13 Jan 2025 08:19:33 -0800 (PST) Received: from x1n (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72d4065c3b4sm6076135b3a.112.2025.01.13.08.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 08:19:32 -0800 (PST) Date: Mon, 13 Jan 2025 11:19:27 -0500 From: Peter Xu To: Oscar Salvador Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Breno Leitao , Rik van Riel , Muchun Song , Naoya Horiguchi , Roman Gushchin , Ackerley Tng , Andrew Morton Subject: Re: [PATCH v2 3/7] mm/hugetlb: Rename avoid_reserve to cow_from_owner Message-ID: References: <20250107204002.2683356-1-peterx@redhat.com> <20250107204002.2683356-4-peterx@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 8A-qIWqNzSobQnEKvXtGAGIIawlPh0jGcjdKS1AMJD0_1736785174 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 9FE98180015 X-Stat-Signature: 9q7i5j8minfi3w9bi73yt4brg6sdj3kc X-Rspam-User: X-HE-Tag: 1736785176-555038 X-HE-Meta: U2FsdGVkX1+s1S4qcb4hwadoJ2+cy17Rg6sNYiDGIkNnJ8dd+gCMNbE06EaSTfEx8AeRYUOtYoeYdmXeoJo2i+cMJ7K4hn/2HNgzJDzXNU95/dtehf8UWREG/9z8c9FwWkwOB6/KNNFpsYcexbZVzHFp0Q9Iv6p2mrZUy12zYFGowSLWUL8MTASZdOz3Z0rQZQqUc30c6Y1KbdMn8LuIGd6MhIMcvLOq9SymbK6yf735nzhCFHDVzEEdTz3K/4ZNm6DG6pjxDxt9o+4JO2iZJ2lnMi9vt/s52yFBAdQ4vsB7LEP9u7ugAE58sgaaF62Jm8cyL6cqLWZ/+VKmOUqak5olddX3DAk0TkVK8uQ5tfuxJD/3X2l3RJ57U78h1ZoGhASUyszKq73vJTAyJF4dg4x/3r+Mx6X7H89ez4pMXB9hY7rMh/MKR/TrfOl3zt0x42fl6ybvU6v6ZeLMeEzLn0WezLuNLboK3RU7i3d2W6VR/qW5BdTV2Le2FPIm9PoQI49RnStUYvs+c87+cYHkQs4JbbBsFZocJsuAq3I74zu/oKS9ij6L2gE3bIzySU8+6acZT5FP9Ex8GNtqk1sj9qgSy3D0x1To7GuEVvui3M/E8TDA6N7+WSP2eI1pEDHlqJYG/1kVeQT1G9E+CFvMWAGhDYVrE7bQJFRy1MN8SIpVE0tYIlOn+J3RCSkMfV3mwawWNR4QxKhimO7Q0NdlyOuj5xFbT16bQMRygM+hoRNP+oVY36vxggYd+KoZ2tSBFqMnxvmISwsTWey0Izz2IBtiqY0xi6nH8PTYnaj+KxcEb+E5kpTGOvWBtGhLqw9+ej9E+dbITWsdM+oIq96qgro1fTmRQV5pJJth0+UrS5kI2OMsaXwAY3Xjbt1w1Pkx6VTGRqLZdKg9b465D5Ti+PTzliWM0avrz0sfRAR7qORpHnaso+O4dNN18tyv14TyBG+3a+XT19ikYV++CRg MpwpnlnD 0dxZZJLbEzcthvGllNczDgh1ADwHhEfrsqjbFiueLwBDNs6dIiEZk+V9d4r5S0AE+ToPBd8dRWlQXo7sSIN9cKl/Vug7T62Bj2Olc6VJpsT0peebMGGrRiRA+MvublqldDI8DotyjxIzeI7f+ZXSMVt0HcGiaijVd1FB8Z47+9V1+FOyEHSahFF5KNbTpNIFgqDPP7aBk4gXmoUqcoYHX+B19g6fDPGShwUsXVc9te649S5DMVnqJtwDEwo/XYAOvfcQaFLN72QCcgKFK9CvGDcKSqudc6DOGf9RnlmVXKDvzKmfgDfgce5RfNVKbBzTp/dRbLGBz4DQFiT8Pj+lLNh9FtnNUQLR5b8VHhEyPuun7DfqNJi4R6AoPpmMzi3U8LJ5QM5bWEq2z0gVrZkDJCO/e71n4PqTFUaLOcmSayGOW7FfmRt9MBo8qn0F8eZ2C6reoTTY+C/F4LA0L9WJVf/7z+wlU4ajLWxgj5gcPQ3QnxhgSifKKD//8A4FQ5Roy9Fz9OIWADocLfsQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Oscar, On Mon, Jan 13, 2025 at 12:20:34PM +0100, Oscar Salvador wrote: > On Tue, Jan 07, 2025 at 03:39:58PM -0500, Peter Xu wrote: > > The old name "avoid_reserve" can be too generic and can be used wrongly in > > the new call sites that want to allocate a hugetlb folio. > > > > It's confusing on two things: (1) whether one can opt-in to avoid global > > reservation, and (2) whether it should take more than one count. > > > > In reality, this flag is only used in an extremely hacky path, in an > > extremely hacky way in hugetlb CoW path only, and always use with 1 saying > > "skip global reservation". Rename the flag to avoid future abuse of this > > flag, making it a boolean so as to reflect its true representation that > > it's not a counter. To make it even harder to abuse, add a comment above > > the function to explain it. > > > > Signed-off-by: Peter Xu > > I agree that the current name is quite misleading, and this patch > improves the situation substantially. > The only thing I am missing here is that the comment you added could be > more explanatory as to why new call sites do not want to make use of the > flag. > > IIRC, not using so, will bypass all vma level reservations as you s/not using/using/? Only using the flag (setting to true) will bypass vma, but I could have misunderstood this line.. > mentioned, which means that the child can get killed if the parent > makes use of the page, as it is the parent the only one that made a > reservation. The paragraph I added on top of alloc_hugetlb_folio() is trying to suggest nobody should set this to true in any new paths. So far, the reservation path should have nothing relevant to stealing page on its own (if that is what you meant above..) - page stealing in hugetlb private is done separately within the unmap_ref_private() helper. Here the parent needs to bypass vma reservation because it must have consumed it with the folio installed in the pgtable (which is write-protected). That may or may not be relevant to page stealing, e.g. if global pool still has free page it doesn't need to affect child from using its hugetlb pages. However again I could have totally misunderstood your comment.. > > So maybe dropping a hint would be nice. > > Reviewed-by: Oscar Salvador Thanks for taking a look! -- Peter Xu