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 90D68C636CC for ; Tue, 7 Feb 2023 17:05:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 25C266B0115; Tue, 7 Feb 2023 12:05:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 20C366B0117; Tue, 7 Feb 2023 12:05:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D52C6B0118; Tue, 7 Feb 2023 12:05:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id F2A296B0115 for ; Tue, 7 Feb 2023 12:05:41 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DB736809F5 for ; Tue, 7 Feb 2023 17:05:40 +0000 (UTC) X-FDA: 80441122440.20.2527C73 Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by imf24.hostedemail.com (Postfix) with ESMTP id A8A02180022 for ; Tue, 7 Feb 2023 17:05:38 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=NrJ1K2Uo; dmarc=none; spf=pass (imf24.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.45 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675789538; 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=RVqRghfkJYuM2PO4hknX+k72h52RQ4rzy+E+T+6Adgk=; b=5+qgLECqGT7kj6HP/zpzrvNQabCIlK1CUWPgYoHk7NBBG+MlXlXdGn0riHcwZTt6OdLidY lSkbUFSxr2YayT1IUqZS3t57yp7zAW4MAHRMLSLchnHhW0kuxuD/J858zbvr6Pyt7kXGcY 1ZcCBRzEoKb2MaCGApneif1DFG8YUY0= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=NrJ1K2Uo; dmarc=none; spf=pass (imf24.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.45 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675789538; a=rsa-sha256; cv=none; b=XZY4tKg+5a0e9VNopQJTNWIxscD0pCj7SfEEwJ+rerl52JL6MAa2kShE63HH5DC7+YlSeg zeiPU/dtCZqZ1AvMSanBQJ1GxH9NUmHcxjimcQQNbjJq/YAPDKdJbrccUuihWw2CWS+fqR bu1SMX9wMnOwxYuvFSuRu2nqf8bx2ew= Received: by mail-io1-f45.google.com with SMTP id l7so5907367ioa.7 for ; Tue, 07 Feb 2023 09:05:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=RVqRghfkJYuM2PO4hknX+k72h52RQ4rzy+E+T+6Adgk=; b=NrJ1K2UoJ7Rjni9tW6A0bOtgmmUrFQgp/gxeUvvugNQ779Tmwsvw5KYFn9fyaEzNI2 /5G3kPoaS3H1IpYLMjHsrXUlf/64rBtMzO6PBpX5X0DGSV02+wINR6dB4vVaXy45K41f XNWxuGObC9U+oBPPi4D9GjlGrfjBdbY/vkPRO8HuBhCuU5uC8S5SDH27CWFzuysxygw7 RNXTxobeIhbufFscikOA/5TWQSQPVjJfvpiqfsSdwBcBNivb7pG1aclHAeZw9s/OSTFB nydAWL8A6IzFP+jEPVNi8grdst9njJIFvsLR2YuL8FPMKspueF6CAze9GhUwyc6+9ZeH zprQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RVqRghfkJYuM2PO4hknX+k72h52RQ4rzy+E+T+6Adgk=; b=E88d4dn+b3s2e5H/ArU1j24U6rHPJNLC1HYPJ80c1OhhsjwkgV/55cnTa///yB67mt dvqp/1qgY4mNZRrtAZIVYmCEQkTnqaRHByRod9ejod1RGlkwUn69qTJtqIvcKUt8IEMh ih/buALCm/7+Q/AXHYOvQXb75L563RXqfweaefO/fGuf+fRJbr2rsJWWVMs+9qWRNPI+ PR0f89vIZz/W/xM+ujw4vxvqu1PwoCvFSe2wbJaaeNDHD8UGztcrDpW5gX1dbxHFsYai cu6Wwql2TMm1LBi9VohWGsr7HBDCCOd+7CFa/COioEpx/dRDmpJvxMfC02EYlWEgMy3/ AGEQ== X-Gm-Message-State: AO0yUKWjEdz3mFBgxTLYg3KYZKCP1wOzmmRNo0d+GvEGtlcwko6ft2Z7 ldIhQm3y1Hnp1mB7MXSt1qnjOA== X-Google-Smtp-Source: AK7set+xmdmUOHgOUZAwmkd+Yvp0LrH9xa5eKR3kv5ts8SsjojKhLGP0LY4aV6GLlDuu29ezIkGDJA== X-Received: by 2002:a6b:1545:0:b0:718:2903:780f with SMTP id 66-20020a6b1545000000b007182903780fmr3019564iov.2.1675789537640; Tue, 07 Feb 2023 09:05:37 -0800 (PST) Received: from [192.168.1.94] ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id j1-20020a02cb01000000b0039e98b2fe5dsm4605239jap.179.2023.02.07.09.05.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Feb 2023 09:05:37 -0800 (PST) Message-ID: <53816439-6473-1c4f-2134-02cd1c46cfe8@kernel.dk> Date: Tue, 7 Feb 2023 10:05:35 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH 09/19] io_uring: convert to use vm_account Content-Language: en-US To: Jason Gunthorpe Cc: Alistair Popple , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, jhubbard@nvidia.com, tjmercier@google.com, hannes@cmpxchg.org, surenb@google.com, mkoutny@suse.com, daniel@ffwll.ch, "Daniel P . Berrange" , Alex Williamson , Pavel Begunkov , io-uring@vger.kernel.org References: <44e6ead48bc53789191b22b0e140aeb82459e75f.1675669136.git-series.apopple@nvidia.com> <52d41a7e-1407-e74f-9206-6dd583b7b6b5@kernel.dk> <87k00unusm.fsf@nvidia.com> From: Jens Axboe In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: A8A02180022 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: eqjrxtocn9onmz6uhc6p8g9dcjh9tpbh X-HE-Tag: 1675789538-801941 X-HE-Meta: U2FsdGVkX1/evrAwHZeb4GZWuO2iZ6Glzst7Z4TeQG67Rz8ugzfuaZMoYANIRSzmM6T55b2yY8MClldeD6wAlvCE4pe7Zh6iFpbxbeGASiRmKbs/YAc03hGfdQvIH4UC4Lv0Nkyf6CG9Az7TbVTePlftFPVJ+Y4cG154/oE7Elp7rEeVbIbK066PYghIdzgp4VsUwL51ef6XjW5chdHc7jHkNOs3bXjaJZVMv2l8JtnS53zJJnMLTNwUEj7KykqWhvyYqnQ9nctYZ3rW7SK0o/v6oVTBORGCGD7n6HMYfHPi6g5E1bSEgFcRE+cCaNy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WtzIFqwkJ8nwua7Qm5aLSSTeQnI2Qwnt/s5TLhpPWYtcYrXXKerS5fKf5A3PV1yH03zcRwog8W1hF66Y04a3nRjZdcqyGkGQGcOYn5IuMnvgbGaMoXl2TZ2EJo= 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: On 2/7/23 7:55?AM, Jason Gunthorpe wrote: > On Tue, Feb 07, 2023 at 07:28:56AM -0700, Jens Axboe wrote: > >> Outside of that, we're now doubling the amount of memory associated with >> tracking this. That isn't necessarily a showstopper, but it is not >> ideal. I didn't take a look at the other conversions (again, because >> they were not sent to me), but seems like the task_struct and flags >> could just be passed in as they may very well be known to many/most >> callers? > > For places doing the mm accounting type it cannot use the task struct > as the underlying mm can be replaced and keep the task, IIRC. > > We just had a bug in VFIO related to this.. > > If we could go back from the mm to the task (even a from a destroyed > mm though) that might work to reduce storage? Then maybe just nest them: struct small_one { struct mm_struct *mm; struct user_struct *user; }; struct big_one { struct small_one foo; struct task_struct *task; enum vm_account_flags flags; }; and have the real helpers deal with small_one, and wrappers around that taking big_one that just passes in the missing bits. Then users that don't need the extra bits can just use the right API. -- Jens Axboe