Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1207076
| From | "George Spelvin" <linux@horizon.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: enabling libgcc for 64-bit divisions, was Re: PROBLEM: XFS on ARM corruption 'Structure needs cl |
| Date | 2015-08-13 21:10 +0200 |
| Message-ID | <pX630-3Qo-13@gated-at.bofh.it> (permalink) |
| References | <pX5qh-2R4-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
>> On x86, the case that msword >= divsor causes a divide exception >> (divide ba generalization of divide by zero), so it's tempting >> to do the same sort of "assume no trap and fix up in the handler" >> trick as <asm/uaccess.h>. > That would be horrible. One of the reasonably common cases of do_div() > is for printing out numbers. And they are often in the 4G+ range.. Actually, printing numbers is *not* such an instance; I've had my fingers in lib/vsprintf.c, and since the divisor is constant, it uses reciprocal multiplies. The only instance of do_div in lib/vsprintf.c is in a version of put_dec() which is used only if BITS_PER_LONG == 64. If bits_per_long == 32, it uses a neat hack due to Douglas Jones which avoids using divide instructions entirely! (Commit 133fd9f5cd if you are curious.) The hot paths with 64-bit results are in the block layer and RAID code, and that's why I wasn't seriously suggesting replacing *all* instances; it was more of a static code size diet hack. (It's also not likely worth the maintenance burden of the additional code subtlety. "Tempting" is not necessarily a good idea.) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: enabling libgcc for 64-bit divisions, was Re: PROBLEM: XFS on ARM corruption 'Structure needs cl "George Spelvin" <linux@horizon.com> - 2015-08-13 08:20 +0200
Re: enabling libgcc for 64-bit divisions, was Re: PROBLEM: XFS on ARM corruption 'Structure needs cl Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 18:30 +0200
Re: enabling libgcc for 64-bit divisions, was Re: PROBLEM: XFS on ARM corruption 'Structure needs cl "George Spelvin" <linux@horizon.com> - 2015-08-13 20:20 +0200
Re: enabling libgcc for 64-bit divisions, was Re: PROBLEM: XFS on ARM corruption 'Structure needs cl Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 20:30 +0200
Re: enabling libgcc for 64-bit divisions, was Re: PROBLEM: XFS on ARM corruption 'Structure needs cl "George Spelvin" <linux@horizon.com> - 2015-08-13 21:10 +0200
csiph-web