svn commit: r280759 - head/sys/netinet

Adrian Chadd adrian at freebsd.org
Sun Mar 29 15:16:47 UTC 2015


On 29 March 2015 at 01:13, Hans Petter Selasky <hps at selasky.org> wrote:
> On 03/28/15 20:16, Gleb Smirnoff wrote:
>>
>> +uint16_t
>> +ip_newid(void)
>> +{
>> +
>> +       counter_u64_add(V_ip_id, 1);
>> +       return (htons((*(uint64_t *)zpcpu_get(V_ip_id)) & 0xffff));
>> +}
>
>
> Technically you would need to enter a critical section here, so that the
> current process doesn't get swapped to a different CPU between the counter
> add and the zpcpu_get.

+10000 here.

You can get preempted and shifted to another CPU at almost any point
in time you're not explicitly asking not to be. It's.. frustrating.




-adrian


More information about the svn-src-all mailing list