[LU-14842] remove use of small variables from *_thread_info Created: 12/Jul/21  Updated: 16/Jul/21

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Andreas Dilger Assignee: Hongchao Zhang
Resolution: Unresolved Votes: 0
Labels: easy

Issue Links:
Related
is related to LU-14831 the OI scrub is triggered repeatedly Resolved
Rank (Obsolete): 9223372036854775807

 Description   

The use of variables like "osd_thread_info->oti_id" is pointless. This is an 8-byte variable that is reused across multiple RPCs, but then an on-stack 8-byte pointer "struct osd_id *id" is used to access it, so there is no stack savings at all. I would rather just declare:

        struct ost_id id = { 0 };

on the stack and remove the use of oti_id completely.

We need a separate series of patches that remove the use of "oti_id/2/3", "oti_fid/2/3", "oti_time", and any other 8- or 16-byte variables from osd_thread_info, mdd_thread_info, mdt_thread_info, etc.

The use of the *_thread_info was meant to avoid repeated large memory allocations and large on-stack allocations, when there was a crazy kernel push to have 4KB stacks, but these small variables were also added for maximal stack savings. Now that 64-bit kernels have 16KB stacks we don't need them.

These *_thread_info variables should not be used for passing hidden values between functions, but if they are it is something that we should also know about, and fix the functions to pass the variables directly as arguments.



 Comments   
Comment by Gerrit Updater [ 16/Jul/21 ]

Hongchao Zhang (hongchao@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/44330
Subject: LU-14842 osd: remove small vars from osd_thread_info
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 89b09f538224dd125d48a19b7062107822ab04fe

Generated at Sat Feb 10 03:13:15 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.