Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1913828rbb; Tue, 27 Feb 2024 05:26:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWu+M6xu76Yk4Hz5BVh3th7/GYFflnSE5w7WYyrGKVlBJ48/F3z12T9R9vXlGezrEd3mwaZAvsX/azio1ZVRjWLlps8rG/ygRlmnxSitg== X-Google-Smtp-Source: AGHT+IGoLRS+0dK9toz5IHcPbEgr7xk6HQjU3lOjHtOLuQ2irHTr1WcAW9n/w0TF4EsHu/Jb7Ill X-Received: by 2002:a05:6870:9597:b0:21e:89bc:31a5 with SMTP id k23-20020a056870959700b0021e89bc31a5mr9907366oao.16.1709040361182; Tue, 27 Feb 2024 05:26:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709040361; cv=pass; d=google.com; s=arc-20160816; b=bt1XG4ewsi8jS63oTPzY9dnoG+xeFOpQuo8Z/fscsnCbXRe2W+TxfkSp+gQoZ2+WeI /8iAdnGBDztZPErK1WVScXhhYeT+lcS8ccXau6BABckz+MIU+mtPaMmF8EnyZHkuS7zE 06mi/HuxtCHSdo/mBz+quRitKZsKT6NhKkQFii5UiHcqTNgcC8lsdsOUgcb1Pg4awBqy PoiftegpmVzkkisOQVgOWJrxckHePJZIHdWUjm6GSTUg0/z4Lom+uvitvWaor314oLXJ S2Y89uPLlp45fkgDM1nkaq74uXtyFdUSR+qu454JkwmrIfg1PqRwGVtO2qFOcWzOT2RN o07g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:in-reply-to:date:subject:cc:to:from:user-agent :references:dkim-signature; bh=tBm5IIGFhkgiqabszftedxFLBNT4N4zs7aN7ZnS5cF0=; fh=hWZJ5vL7apnBwditQJeX48udjemFTi3igNYrQF6ecjQ=; b=GCFVjSj4MIV8/1Q3xjhFrKMhISwZ2vbo6otelHj6s1QxsL/Z4m4Vow3u5GpnVceewI jk7KTeNV9L7ew+JgREabC5RO5gwKbwybwe4ob8ngf2fRvFkF72bTFoKIlV7hO4SEi8z5 ddYfYY5i39M1/NGZ+n5OmdmAW+iWrGvjWbFB5w1J730cfVH9zIDY0Fk0c+sl7Obapo2d j9heLPfcmUpy6xtX0yLe2nlrRDHyV7xJeubFHgHylbYn3kMWo0Ur9XM9bw4K3PJa3pb6 Gq8wLtV7nGiHiNRTAyQTSPx3qzQ6VVuk/tQxm9rYzR6HDCf3shG9gwoA/Xc2IIV7XI1m xGRw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@metaspace-dk.20230601.gappssmtp.com header.s=20230601 header.b=p3MkRpx5; arc=pass (i=1 dkim=pass dkdomain=metaspace-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-82870-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82870-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a2-20020a05620a02e200b0078715778c95si7026738qko.42.2024.02.27.05.26.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:26:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82870-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@metaspace-dk.20230601.gappssmtp.com header.s=20230601 header.b=p3MkRpx5; arc=pass (i=1 dkim=pass dkdomain=metaspace-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-82870-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82870-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 17AA61C21B9E for ; Tue, 27 Feb 2024 08:36:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5028C55E71; Tue, 27 Feb 2024 08:36:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=metaspace-dk.20230601.gappssmtp.com header.i=@metaspace-dk.20230601.gappssmtp.com header.b="p3MkRpx5" Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 4AD687B3D3 for ; Tue, 27 Feb 2024 08:36:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709022988; cv=none; b=HWPYb76hs92WcATLRgnfkekg82sBYWTS2WRdRntxlBzHKxDWbvU2GXLzK6SeDnZQrpH2jchRq79iiQexUu1nmYmfoJO0ZI4tEySKsFhtmNj26rsIZ4z88tZ4tYt0CNZ1UlHh9QD/rWx4afiIViuopuAkFQimCGXhh9GaMYIZ52g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709022988; c=relaxed/simple; bh=tBm5IIGFhkgiqabszftedxFLBNT4N4zs7aN7ZnS5cF0=; h=References:From:To:Cc:Subject:Date:In-reply-to:Message-ID: MIME-Version:Content-Type; b=pfiBgV69CzBUO2NAfy6m9NPhLt3CzynwyQNi6p6CUXPm1wYHqzyA8rGC5ueyclPnrd6XTAtEUAKzG0jA9nce18kpWjLxHlYUZdf745JW4EPYLoXunVXHyfsJW5W5blgos0iTvPskIxeu0ZCt89nTeNH+arSPbpqx5KBoAsVg5ZM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=metaspace.dk; spf=none smtp.mailfrom=metaspace.dk; dkim=pass (2048-bit key) header.d=metaspace-dk.20230601.gappssmtp.com header.i=@metaspace-dk.20230601.gappssmtp.com header.b=p3MkRpx5; arc=none smtp.client-ip=209.85.218.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=metaspace.dk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=metaspace.dk Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a3e8c1e4aa7so388869466b.2 for ; Tue, 27 Feb 2024 00:36:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=metaspace-dk.20230601.gappssmtp.com; s=20230601; t=1709022984; x=1709627784; darn=vger.kernel.org; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=tBm5IIGFhkgiqabszftedxFLBNT4N4zs7aN7ZnS5cF0=; b=p3MkRpx5VREXJOooask2Br8TOUkyDZYl/l0UMQyjnwqe4Ky7hzSk7soSnuZaNmnGFP TOGRx1rW8rZwuXgnvAUF16AifvepYlW5SiFjiz9gUWXZkbw4O+5OrRrs8yRwYLdGD1Ax oDseHewatyh8+ZG0iwtA6vdcC28bCXguxcsTHWXMv1+WgQP0NFgd6UMInRNBLODDNCJi yazVQHrbPIWFm6YUyn0ypsmjwZrLGUUnNquVAYHg6vVABS3ddMFP/T1W1GTe/NIjyFA/ juU7cnmPfdTDXEH700c+XXWIOefma1P0YwG3sFiKCUDqEllPSXwG5Ed0ZiX7L96WPvUT 6G9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709022984; x=1709627784; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=tBm5IIGFhkgiqabszftedxFLBNT4N4zs7aN7ZnS5cF0=; b=RguamruRBwifhaGp5fHxxWT3tMOfg6ZYZEF87ZhI/PWv8vqVC4LpaQhsK6TYlNcyu8 ZWeHjOZz9n4J5WgpE9Vk9/caXd/Vh0rTAHNQ6/eVYKCz6Gud+UsSd8ZU3Ou9gMgBKwcO J6QGSXhB3RM8cshyu+ZD52SrUCtgOKDNJL78zEyHKX3MusXpsBxxpPjbNZJ6ZgiUPKVM Y5B4pCLgccJFdYXDsW9t/pznqCF2kHtleraioFjU4mOgKT+DbEhX01yZsfWwx92IuRHK SwYAyhZFIgfQal6hTSIO6o9glNEme7uPM0D6di5j6rwujD6cGCuOP9/weA8Xf3KgobQl Ifbg== X-Forwarded-Encrypted: i=1; AJvYcCXqpKMiQLJVWYnKuqk8f+dikrr1mEgbIniZy47owlCqpxJAVyUGBV2vsC9vr9JcE5L5NWap8hrNlhpFYaCOCakoTZs76WELryaRuTyP X-Gm-Message-State: AOJu0YyQwla0atOWOL4RbQFICALh63FsX7YJd5Z4sYdR/60rtkxAiC4y UXSybf/aB52kjEbVcQAclE9Qt+Csu+NxbnevF5wrWVTIffynviYSXh931d7e380= X-Received: by 2002:a17:906:c7d4:b0:a43:20c0:6f7a with SMTP id dc20-20020a170906c7d400b00a4320c06f7amr4112372ejb.48.1709022984519; Tue, 27 Feb 2024 00:36:24 -0800 (PST) Received: from localhost ([79.142.230.34]) by smtp.gmail.com with ESMTPSA id hu11-20020a170907a08b00b00a3fcbd4eb2esm532864ejc.1.2024.02.27.00.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 00:36:24 -0800 (PST) References: <20240208-alice-mm-v2-0-d821250204a6@google.com> <20240208-alice-mm-v2-4-d821250204a6@google.com> User-agent: mu4e 1.10.8; emacs 29.2 From: Andreas Hindborg To: Alice Ryhl Cc: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , Benno Lossin , Kees Cook , Al Viro , Andrew Morton , Greg Kroah-Hartman , Arve =?utf-8?B?SGrDuG5uZXbDpWc=?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Arnd Bergmann , linux-mm@kvack.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Christian Brauner Subject: Re: [PATCH v2 4/4] rust: add abstraction for `struct page` Date: Tue, 27 Feb 2024 09:32:27 +0100 In-reply-to: <20240208-alice-mm-v2-4-d821250204a6@google.com> Message-ID: <87h6hu9udb.fsf@metaspace.dk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Hi Alice, Alice Ryhl writes: > Adds a new struct called `Page` that wraps a pointer to `struct page`. > This struct is assumed to hold ownership over the page, so that Rust > code can allocate and manage pages directly. > +/// A bitwise shift for the page size. > +pub const PAGE_SHIFT: usize = bindings::PAGE_SHIFT as usize; > +/// The number of bytes in a page. > +pub const PAGE_SIZE: usize = 1 << PAGE_SHIFT; For consistency, could we get page size from bindings as well? The folio patches already do this [1]. BR Andreas [1] https://lore.kernel.org/rust-for-linux/20231018122518.128049-10-wedsonaf@gmail.com/