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 1DF78C46CD2 for ; Tue, 30 Jan 2024 09:06:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72C7A6B00A9; Tue, 30 Jan 2024 04:06:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DB966B00AA; Tue, 30 Jan 2024 04:06:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57BCD6B00AB; Tue, 30 Jan 2024 04:06:24 -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 457FF6B00A9 for ; Tue, 30 Jan 2024 04:06:24 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 18F8FA1EA3 for ; Tue, 30 Jan 2024 09:06:24 +0000 (UTC) X-FDA: 81735396288.26.525946A Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) by imf09.hostedemail.com (Postfix) with ESMTP id 4B96614002F for ; Tue, 30 Jan 2024 09:06:22 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=sJsPsziB; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf09.hostedemail.com: domain of aliceryhl@google.com designates 209.85.222.51 as permitted sender) smtp.mailfrom=aliceryhl@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706605582; 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=3ZhWHmKw4vi7AxSEO7CuV+xNiUe+yFZ2ZzlwsymAg/E=; b=I1vjk0iCAG1PAcgU7dML1SZUPE/gzYcuTx+kpY4BAqjjOX9rB474S4Hcgt1Abi3sCXQ9xv mWu+0HwFq1vUug49YWGJXuUj/GOi4jsvwM3L5kx56HF0e7jHNYKB6th0DHU0lf2eeu63RA vVXo8c+Na93I/zODRq7ojWWDLh4pYI0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=sJsPsziB; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf09.hostedemail.com: domain of aliceryhl@google.com designates 209.85.222.51 as permitted sender) smtp.mailfrom=aliceryhl@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706605582; a=rsa-sha256; cv=none; b=8Zky/6rsMyUvazBCbJg7eTEY7QomTmbxwmYdWSmNYy/cPlq9DT2G6vr2K9jkg+6aibVeuN Vuh4iKdc8ElixkRuSygukIw3HQSCKd11oC0aK57aRdAGIPGwPAIoqzH6jYwe7275r9/NmP V9r4jXsCYQ2twAow7J31LGkmV7q5PgY= Received: by mail-ua1-f51.google.com with SMTP id a1e0cc1a2514c-7ce603b9051so1481912241.2 for ; Tue, 30 Jan 2024 01:06:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706605581; x=1707210381; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=3ZhWHmKw4vi7AxSEO7CuV+xNiUe+yFZ2ZzlwsymAg/E=; b=sJsPsziBDWUDeLqYujT/CC18TUzKvMopouMKqqBKBXe6bL0jPjfMHFM4LDbq0cRlUu dCDNBFLLrE47tKihyIV/dvT1OFNX/EI+4fAHMTz8m6QPUIwxAi+9VjaVe3SDrROXroeD fd3lYDNj9/EbRwIFtq6vUsXY7LeFIYYLsbVRpyarurFJnsdks6hXcc5ImzckBUgaYNMK SUjN5LT0FSzM7hJNfslyfFIQIsB2iQok85ptV1NPd+Q7vxSxD/vhQAbqAcopuY5uQhWG JHpWR9NdN6rWZwKUSZJIYerK6LIkY0gtCKZJ88RVWz42nrvMDLPwibwpwOgiItQlqege TudQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706605581; x=1707210381; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3ZhWHmKw4vi7AxSEO7CuV+xNiUe+yFZ2ZzlwsymAg/E=; b=DjvgG5WFY7csHbC0IrBnpfSk8qjj8B2Lpu8u24TXDmtCdW1RCCCwLzd2KlZgVRNBL9 HRSosMoZztYEYnwltA8B3dDXrtRynhH0X3y7YEd6d+anSkZSgEFP7WhhxBOnxGI9bZk1 zjATdWnzrdPrUm2cgd60CphOUITLuv54kiFOVb53cMJs8VYC1D7yoChEt7dUjBRFt7Co jaHGUztvg+qfjsL471a9mFL/To759Nc4DUI0jBqmCUFDA0+QLnMJ6WewRKORAfLX+CYv NPysi/WyU3sVznpmxzOYNC7O4oyRlhWbThpKtqkXtGao/yI0FB54++JEaqI3Xa6oLc3I 8WCg== X-Gm-Message-State: AOJu0YzccysPWh1WrUKHc/ljeWJniR41hvOskfIGnuxr9wGSoXuNjVrx 07siujzmDPhodC+T7zVeJYKrJ5TC/WxBo6SiUyKMe6J27QHOff1bVtVEPC08vb3fdcWgnqweieV PVL6bI3BlBBpfqUdkXEArJKb8645lMJGZx/rw X-Google-Smtp-Source: AGHT+IFRKvthvPaK/eQQw262qb3uj3gwoqQFpPfljrQVEpXmKBSAG0JgZF/aeoOMlfcPoJI9wUzPo2V3cNjqBI6Lioc= X-Received: by 2002:a05:6122:45a5:b0:4b7:689d:9d9 with SMTP id de37-20020a05612245a500b004b7689d09d9mr3412354vkb.32.1706605581206; Tue, 30 Jan 2024 01:06:21 -0800 (PST) MIME-Version: 1.0 References: <20240124-alice-mm-v1-0-d1abcec83c44@google.com> <20240124-alice-mm-v1-3-d1abcec83c44@google.com> <87mssngpnc.fsf@samsung.com> In-Reply-To: <87mssngpnc.fsf@samsung.com> From: Alice Ryhl Date: Tue, 30 Jan 2024 10:06:09 +0100 Message-ID: Subject: Re: [PATCH 3/3] rust: add abstraction for `struct page` To: Andreas Hindborg Cc: Matthew Wilcox , 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 , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4B96614002F X-Stat-Signature: p7i5mt9ptc1ujz81i49pikr5xok34oa8 X-Rspam-User: X-HE-Tag: 1706605582-245647 X-HE-Meta: U2FsdGVkX1/NjSRDty6JFpMZz9mCIHE8IbsGgL54YuOoNqIjxwdnqoYVbaPrCkeoxX4z3vYtrl0NegUyaFc2LI2eHrt4uTfP/nYCwlb4MwIbFWYh7Pc3HriH4O9BiZAnqPCHdqoFRhmCXZHvzIsg7L/nzBtPaceU0Tu2/SyHhcS0df1iTJnOuRotiuzNTtfwmgFr6kuy1iIhnMNVkw+D06qxv+zK0WIYtKlhQyKSmQq1996lMvDOgooKtw+lpeWMRBfNTcVH9PfTPNfaiGGUhOOEEevqk+DQn0rGojLWzxRPZ4j+w2ZGlvlkUHgdMGrzt6r25fcbmAyRgN4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5/bUk6e4+cw7nEHMVQ= 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: List-Subscribe: List-Unsubscribe: On Tue, Jan 30, 2024 at 10:02=E2=80=AFAM Andreas Hindborg wrote: > > > Matthew Wilcox writes: > > > On Wed, Jan 24, 2024 at 11:20:23AM +0000, Alice Ryhl wrote: > >> +impl Page { > >> + /// Allocates a new set of contiguous pages. > >> + pub fn new() -> Result { > >> + // SAFETY: These are the correct arguments to allocate a sing= le page. > >> + let page =3D unsafe { > >> + bindings::alloc_pages( > >> + bindings::GFP_KERNEL | bindings::__GFP_ZERO | binding= s::__GFP_HIGHMEM, > >> + 0, > >> + ) > >> + }; > > > > This feels too Binder-specific to be 'Page'. Pages are not necessarily > > allocated with GFP_HIGHMEM, nor are they necessarily zeroed. Maybe you > > want a BinderPage type? > > Rust null block uses the same definition of these flags [1], so there is > at least that synergy. > > I feel like we had the discussion of the flags before, although I can't > find the thread now. I think the conclusion was that we fix them until > we have code that need to actually change them (as to not add dead > code). I don't think there's any problem with replacing the constructor with one that takes a flag argument dead-code-wise. I can definitely do that. Alice