From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 68812343D9C for ; Wed, 5 Nov 2025 19:56:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762372604; cv=none; b=KnxYVV6BuOhtLywvhJ4y7bJ9QUqjV14puOzkYRv+h4pbaFcoUeakwsiQ6fT0AYiIyPV9jEOGQX/Y7JpBCi4eI8EukVVviLVDE4uHDJXh18BShU+slU/JPwUkynq05hPD7wSc4hDMOja9P/xX6ow7cPiG/ASTbtpVGrAXVgwKLro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762372604; c=relaxed/simple; bh=y0djx7SaSKxrg38g7Mq/6kY7uEuPs6Y4jirNJDxy4Uo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Ouxxj/EkiLLaFBCeq4D8nhvZft0CX/yzMoeRv1sB5Pn6qx/GhAGhRsHe+OQdnbZAWEh4+NdCjMJrf6ANZ2nvOswaxZqg06Vq3lbmK6nOeTHWvjsrBsxyNMX5rudm99h0ZDg5EFoq4cwh1XgPp+ZvYVxB/CgNlU0QaeZ9XR9EyjY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=f2SV8ynx; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=dCPUd4wU; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="f2SV8ynx"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="dCPUd4wU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762372602; 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=RfRdq0AOLjAvRpFgewWvnXKqu09Gq6WPLf3shQQBn6o=; b=f2SV8ynxT+vWq6qo+qIcTATLzYz3kByfGhT4mMHOgXgK+HSD9iCJLelPbg3km9/71uSkWF w+YN2FrXYCsUZOYgUwBxpt4Vv7VwvLYubeylXHnF2MnhZx9Pz0YBwDw6wlUE6fNR/6znPz MIuzne1EW3CgP2dSihwqzT9rxH8whT0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-543-nAktfSeQM-6mZPvo51IvkQ-1; Wed, 05 Nov 2025 14:56:39 -0500 X-MC-Unique: nAktfSeQM-6mZPvo51IvkQ-1 X-Mimecast-MFC-AGG-ID: nAktfSeQM-6mZPvo51IvkQ_1762372598 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-47113538d8cso1074085e9.1 for ; Wed, 05 Nov 2025 11:56:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762372598; x=1762977398; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=RfRdq0AOLjAvRpFgewWvnXKqu09Gq6WPLf3shQQBn6o=; b=dCPUd4wUDwoikIXTihkjC5+8ZLU9JgtloI7GLZ+q64xLT0biQ8j0HLtCqsfcgEdv2C Brg2q9FoCDZ75vOlnPaGiWxMrqroASjcmmEGay9Lgbzml7QJg5z9EsOvVLPzPb0/Zxcz csRp2rNYObE104mkvvIXsyGV695Rk7inc2VRtxADfH0wkaUJEPHutcSO+6hxqzjtA3po CbFi8+/1Z/F24+2Mu7wOuV0bZ5FWr2uMhZUm40z6JypB9rQbdXJQOOyBUatFq3DDJhHv 0OPyqzoRFeq7Pu5eRWr8RZo7Zk2Jgxmpoaa2ArF1JEmYk3Ksq+3mAZuwchWByKmuJy82 N+ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762372598; x=1762977398; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RfRdq0AOLjAvRpFgewWvnXKqu09Gq6WPLf3shQQBn6o=; b=enCMPowtM7M9YGZyG8VG1Ubri+MxTh4q5pO3OEMkcFoe70XgC66c+qUQF/EBNy02s2 U94u7EG+N/zFqi7V8RNOpZZ+/XYVLU2tY6tBtUtLfSpM3vRB8Af+Uo80iLKXkamYegwA voCfhgHHHytjYvLztCSQV1ZHQtxdxwRILn1j0Gm8RsJarAWo1DTxLBwT/iZ2onGyf1p9 M94wxWUcU+hGmoFbSVxifOv7wxIFLEcNFD+yFazadVar5YowefTFgbb9mRUFI57zJeST 6yYaTh/qzigc1h5+DtVvY26iVFe/fYhNsoccn91esmNPjMc11lueWaBCa8rqwF5Cdlgz uDTA== X-Forwarded-Encrypted: i=1; AJvYcCWY7zdIkp48Y0jGNUaGmyzC8dyMXffrZsZd6aeVFsl2t/9P5UPTmVlhEjSob0rMvUZkF1Ts/kKVW8Ui@vger.kernel.org X-Gm-Message-State: AOJu0YyP19Yn2NYLyEdl9JSo6TydF7qfMv65/1QMjTZ21F4a6OSOafTi NXCsjAfPZNvBOtCOdXcnoogZFZWwkHRx0X72vYIvTp8QxMx0LhYSlR217EgwPcowU9MWBB3yFeD tHZ8/yQbVOWrxeHFaCDlxX0ANnUcs+nMMuTjceg0FMDXXuS5UjzW6hj5RtNgKVw4= X-Gm-Gg: ASbGncv2Fy2v1lHKJYLV1efFJFqNuH+colv++ien4k3Z7NklOMCHGpW3JflFaYKTDc/ mOmbhqv1tVGzwQWq6HvDjVH7VurahX10pYlZkQ/ok+wBPWMCfOCD72ABbSW1omYOgYB7SPIHyOH Nyrl9ngwXLVtinIuZh1nQYL5iMaZ8cab2xPjlNKX9APUS360f4/ZMMkHS/PttSe7pKoKD8uwOwW WqzxShjuEGVJNLCzzG3uJsgcOXy7YlmN93+gTTzUIhFWhrpXtdAZyEcstcSLggHTLtcheaSsDT1 P7JKqrn0gAhCqYxss20oY82Zp9sI51T3uiSJBAEUCoUKVzxqfsgkKki4gW94uDQ8PspLk92Zilv zl3kky+1A23/fRFLlObZ/JqrE+unGo4BIZ5xXN3eVYnxA/H46jALUGJA/8tagLKqYpIRVDRKqtl Vbx7EGAkc8fE+lsmjw/l+Apg== X-Received: by 2002:a05:600c:348f:b0:46f:b43a:aee1 with SMTP id 5b1f17b1804b1-4775ce2c7eemr29950145e9.38.1762372598045; Wed, 05 Nov 2025 11:56:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHK7yLH47QUN086LZNyuRAD2Zw/GPvRFlywAZeFx22RAaEduz3ojwl4v/Mo8ax5jk1OZayf5g== X-Received: by 2002:a05:600c:348f:b0:46f:b43a:aee1 with SMTP id 5b1f17b1804b1-4775ce2c7eemr29949845e9.38.1762372597551; Wed, 05 Nov 2025 11:56:37 -0800 (PST) Received: from ?IPV6:2003:d8:2f30:b00:cea9:dee:d607:41d? (p200300d82f300b00cea90deed607041d.dip0.t-ipconnect.de. [2003:d8:2f30:b00:cea9:dee:d607:41d]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4775cdc33bdsm64219765e9.1.2025.11.05.11.56.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Nov 2025 11:56:36 -0800 (PST) Message-ID: Date: Wed, 5 Nov 2025 20:56:34 +0100 Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 02/16] mm: introduce leaf entry type and use to simplify leaf entry logic To: Lorenzo Stoakes , Gregory Price Cc: Matthew Wilcox , Andrew Morton , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Sven Schnelle , Peter Xu , Alexander Viro , Christian Brauner , Jan Kara , Arnd Bergmann , Zi Yan , Baolin Wang , "Liam R . Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Muchun Song , Oscar Salvador , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , Axel Rasmussen , Yuanchu Xie , Wei Xu , Kemeng Shi , Kairui Song , Nhat Pham , Baoquan He , Chris Li , SeongJae Park , Jason Gunthorpe , Leon Romanovsky , Xu Xin , Chengming Zhou , Jann Horn , Miaohe Lin , Naoya Horiguchi , Pedro Falcato , Pasha Tatashin , Rik van Riel , Harry Yoo , Hugh Dickins , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, damon@lists.linux.dev References: <2c75a316f1b91a502fad718de9b1bb151aafe717.1762171281.git.lorenzo.stoakes@oracle.com> <373a0e43-c9bf-4b5b-8d39-4f71684ef883@lucifer.local> From: David Hildenbrand Content-Language: en-US In-Reply-To: <373a0e43-c9bf-4b5b-8d39-4f71684ef883@lucifer.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 05.11.25 20:52, Lorenzo Stoakes wrote: > On Wed, Nov 05, 2025 at 02:25:34PM -0500, Gregory Price wrote: >> On Wed, Nov 05, 2025 at 07:06:11PM +0000, Matthew Wilcox wrote: >>> On Mon, Nov 03, 2025 at 12:31:43PM +0000, Lorenzo Stoakes wrote: >>>> The kernel maintains leaf page table entries which contain either: >>>> >>>> - Nothing ('none' entries) >>>> - Present entries (that is stuff the hardware can navigate without fault) >>>> - Everything else that will cause a fault which the kernel handles >>> >>> The problem is that we're already using 'pmd leaf entries' to mean "this >>> is a pointer to a PMD entry rather than a table of PTEs". >> >> Having not looked at the implications of this for leafent_t prototypes >> ... >> Can't this be solved by just adding a leafent type "Pointer" which >> implies there's exactly one leaf-ent type which won't cause faults? >> >> is_present() => (table_ptr || leafent_ptr) >> else(): => !leafent_ptr >> >> if is_none() >> do the none-thing >> if is_present() >> if is_leafent(ent) (== is_leafent_ptr) >> do the pointer thing >> else >> do the table thing >> else() >> type = leafent_type(ent) >> switch(type) >> do the software things >> can't be a present entry (see above) >> >> >> A leaf is a leaf :shrug: >> >> ~Gregory > > I thought about doing this but it doesn't really work as the type is > _abstracted_ from the architecture-specific value, _and_ we use what is > currently the swp_type field to identify what this is. > > So we would lose the architecture-specific information that any 'hardware leaf' > entry would require and not be able to reliably identify it without losing bits. > > Trying to preserve the value _and_ correctly identify it as a present entry > would be difficult. > > And I _really_ didn't want to go on a deep dive through all the architectures to > see if we could encode it differently to allow for this. > > Rather I think it's better to differentiate between s/w + h/w leaf entries. (Being rather silent because I'm busy with all kinds of other stuff) I agree :) As Willy said, something that spells out "sw leaf" would be nice. -- Cheers David