svn commit: r340676 - in head/sys: kern sys

Mateusz Guzik mjguzik at gmail.com
Wed Nov 28 23:42:31 UTC 2018


On 11/26/18, John Baldwin <jhb at freebsd.org> wrote:
> On 11/22/18 9:28 AM, Mateusz Guzik wrote:
>> diff --git a/sys/sys/systm.h b/sys/sys/systm.h
>> index a1b98c5660c..fab94ee7979 100644
>> --- a/sys/sys/systm.h
>> +++ b/sys/sys/systm.h
>> @@ -523,7 +523,11 @@ int alloc_unr_specific(struct unrhdr *uh, u_int
>> item);
>>  int alloc_unrl(struct unrhdr *uh);
>>  void free_unr(struct unrhdr *uh, u_int item);
>>
>> -#if defined(__mips__) || defined(__powerpc__)
>> +#if defined(mips) && !defined(__mips_n64) && !defined(__mips_n32)
>> +#define UNR64_LOCKED
>> +#endif
>
> This would perhaps be shorter as:
>
> #if defined(__mips__) && defined(__mips_o32)
>
>> +
>> +#if defined(__powerpc__) && !defined(__powerpc64__)
>>  #define UNR64_LOCKED
>>  #endif
>
> It's not clear to me why this isn't just conditional on LP64 though.
> If 32-bit riscv existed in FreeBSD it would also not have this.  If we
> really care that much about i386 and 32-bit arm you could write it as:
>
> #if !(defined(__LP64__) || defined(__i386__) || defined(__arm__))
>
> (I'm not sure we care that much though and think we could just use __LP64__
> alone and call it a day.)
>

There will be future optimizations which would be defeated for platforms
resorting to the lock, but playing around it may not be worth it.

That said, if noone objects I'll just __LP64__ as suggested:

diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index a1b98c5660c..b250c54033c 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -523,7 +523,7 @@ int alloc_unr_specific(struct unrhdr *uh, u_int item);
 int alloc_unrl(struct unrhdr *uh);
 void free_unr(struct unrhdr *uh, u_int item);

-#if defined(__mips__) || defined(__powerpc__)
+#ifndef __LP64__
 #define UNR64_LOCKED
 #endif

-- 
Mateusz Guzik <mjguzik gmail.com>


More information about the svn-src-head mailing list