From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "Yang, Weijiang" <weijiang.yang@intel.com>,
"Hansen, Dave" <dave.hansen@intel.com>,
"seanjc@google.com" <seanjc@google.com>,
"x86@kernel.org" <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>
Cc: "peterz@infradead.org" <peterz@infradead.org>,
"john.allen@amd.com" <john.allen@amd.com>,
"Gao, Chao" <chao.gao@intel.com>,
"mlevitsk@redhat.com" <mlevitsk@redhat.com>
Subject: Re: [PATCH 0/6] Introduce CET supervisor state support
Date: Thu, 11 Jul 2024 22:55:17 +0000 [thread overview]
Message-ID: <90a70461d15b9053e0507beda20b448194ba5eb4.camel@intel.com> (raw)
In-Reply-To: <4bba0c20-0cd0-4c1a-abf0-511ba6940a57@intel.com>
On Thu, 2024-07-11 at 15:30 -0700, Dave Hansen wrote:
> > > $BYTES is 24, right? Did I get anything wrong?
> >
> > Do we know what the actual memory use is? It would increases the size asked
> > of
> > of the allocator by 24 bytes, but what amount of memory actually gets
> > reserved?
> >
> > It is sometimes a slab allocated buffer, and sometimes a vmalloc, right? I'm
> > not
> > sure about slab sizes, but for vmalloc if the increase doesn't cross a page
> > size, it will be the same size allocation in reality. Or if it is close to a
> > page size already, it might use a whole extra 4096 bytes.
>
> Man, I hope I don't have this all mixed up in my head. Wouldn't be the
> first time. I _think_ you might be confusing thread_info and
> thread_struct, though. I know I've gotten them confused before.
>
> But we get to the 'struct fpu' via:
>
> current->thread.fpu
>
> Where current is a 'task_struct' which is in /proc/slabinfo and 'struct
> thread_struct thread' and 'struct fpu' are embedded in 'task_struct',
> not allocated on their own:
I think thread_struct is always a slab, but the current->thread.fpu.fpstate
pointer can be reallocated to point to a vmalloc in fpstate_realloc(), in the
case of XFD features.
>
> task_struct 2958 3018 10048 3 8 ...
>
> So my current task_struct is 10048 bytes and 3 of them fit in each
> 8-page slab, leaving 2624 bytes to spare.
>
> I don't think we're too dainty about adding thing to task_struct. Are we?
So for you there would actually not be any extra memory usage to unconditionally
add 24 bytes to the xstate. But, yes, it all could change for a number of
reasons.
>
> > So we might be looking at a situation where some tasks get an entire extra
> > page
> > allocated per task, and some get no difference. And only the average is 24
> > bytes
> > increase.
>
> I think you're right here, at least when it comes to large weirdly-sized
> slabs. But _so_ many things affect task_struct that I've never seen
> anyone sweat it too much.
Makes sense. Then I can't think of any argument to move from case 2.
next prev parent reply other threads:[~2024-07-11 22:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 9:03 Yang Weijiang
2024-05-31 9:03 ` [PATCH 1/6] x86/fpu/xstate: Always preserve non-user xfeatures/flags in __state_perm Yang Weijiang
2024-05-31 9:03 ` [PATCH 2/6] x86/fpu/xstate: Add CET supervisor mode state support Yang Weijiang
2024-05-31 9:03 ` [PATCH 3/6] x86/fpu/xstate: Introduce XFEATURE_MASK_KERNEL_DYNAMIC xfeature set Yang Weijiang
2024-05-31 9:03 ` [PATCH 4/6] x86/fpu/xstate: Introduce fpu_guest_cfg for guest FPU configuration Yang Weijiang
2024-05-31 9:03 ` [PATCH 5/6] x86/fpu/xstate: Create guest fpstate with guest specific config Yang Weijiang
2024-05-31 9:03 ` [PATCH 6/6] x86/fpu/xstate: Warn if CET supervisor state is detected in normal fpstate Yang Weijiang
2024-07-09 3:17 ` [PATCH 0/6] Introduce CET supervisor state support Yang, Weijiang
2024-07-11 20:58 ` Dave Hansen
2024-07-11 22:11 ` Edgecombe, Rick P
2024-07-11 22:30 ` Dave Hansen
2024-07-11 22:55 ` Edgecombe, Rick P [this message]
2024-07-12 14:36 ` Dave Hansen
2024-07-12 6:27 ` Yang, Weijiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90a70461d15b9053e0507beda20b448194ba5eb4.camel@intel.com \
--to=rick.p.edgecombe@intel.com \
--cc=chao.gao@intel.com \
--cc=dave.hansen@intel.com \
--cc=john.allen@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=weijiang.yang@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®