-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util/bufpool: Add new flag to skip zeroing new memory allocations #10846
base: main
Are you sure you want to change the base?
Conversation
prov/util/src/util_buf.c
Outdated
@@ -269,8 +270,7 @@ int ofi_bufpool_create_attr(struct ofi_bufpool_attr *attr, | |||
pool->region_size = pool->alloc_size - pool->entry_size; | |||
|
|||
FI_DBG(&core_prov, FI_LOG_CORE, | |||
"%s alloc_size %zu region_size %zu align_entry %zu " | |||
"entry_size %zu chuck_cnt %ld pool %p (%p)\n", | |||
"%s alloc_size %zu region_size %zu align_entry %zu entry_size %zu chunk_cnt %ld pool %p (%p)\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line length is too long, please revert change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Note this change also corrects a typo, chuck_cnt
-> chunk_cnt
)
According to the Linux kernel coding style guidelines:
However, never break user-visible strings such as printk messages because that breaks the ability to grep for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I know the kernel guidelines. The print includes the file and line number anyway, so grep isn't needed. Besides, it's not like someone can take the print output and toss it into grep anyway. They have to know how and where to convert portions of the output into a regular expression.
Please keep the typo fix, but not make me need to scroll left/right in my editor. My eyeballs hate that.
Please squash the commits. |
f003cfb
to
d406496
Compare
Appveyor tests are failing. They are likely related. |
prov/util/src/util_buf.c
Outdated
@@ -317,3 +318,8 @@ int ofi_ibufpool_region_is_lower(struct dlist_entry *item, const void *arg) | |||
|
|||
return reg1->index < reg2->index; | |||
} | |||
|
|||
void ofi_bufpool_init_noop(struct ofi_bufpool_region *region, void *buf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title line of the commit message is a little long and a little confusing. Maybe:
util/bufpool: Add noop init callback to skip zeroing memory
prov/util/src/util_buf.c
Outdated
void ofi_bufpool_init_noop(struct ofi_bufpool_region *region, void *buf) | ||
{ | ||
/* This function is purposely empty */ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a subsequent change that will use this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a subsequent change that will use this function?
There was going to be, but N/A now given the different approach I'll be pursuing.
When a buf pool allocates a new chunk of memory, the entire memory chunk is zeroed out via a call to memset. This can be quite costly, occur at inconvenient times, and end up being wasteful when buf pool users initialize their own entries. This change adds a new OFI_BUFPOOL_NO_ZERO flag and will skip the memset when that flag is set. Signed-off-by: Ben Lynam <[email protected]>
d406496
to
a224b3e
Compare
When a buf pool allocates a new chunk of memory, the entire memory
chunk is zeroed out via a call to memset. This can be quite costly,
occur at inconvenient times, and end up being wasteful when buf pool
users initialize their own entries.
This change adds a new OFI_BUFPOOL_NO_ZERO flag and will skip
the memset when that flag is set.