On Thu, Jul 20, 2017 at 11:48:41AM -0400, Joe Lawrence wrote: > On a related note, if we keep the allocations and memcpy, how about I > shift around the attach/get calls like so: > > __klp_shadow_attach > set shadow variable member values > memcpy > add to hash > > klp_shadow_attach > alloc new shadow var > lock > call __klp_shadow_attach with new alloc > unlock > > klp_shadow_get_or_attach > be optimistic, call klp_shadow_get (if found, return it) > be pessimistic, alloc new shadow var > lock > call klp_shadow_get again > if unlikely found > kfree unneeded alloc > else > call __klp_shadow_attach with new alloc > unlock > return whichever shadow var we used > > This way both calls can accept gfp_flags that may sleep, with the only > downside that klp_shadow_get_or_attach may allocate an unnecessary > shadow variable in the unlikely case that it's found on the second > klp_shadow_get attempt (under the lock). No more clunky "bool lock" > flag either. :) Sounds good to me! -- Josh -- To unsubscribe from this list: send the line "unsubscribe live-patching" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html