mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Phillips <phillips@bonn-fries.net>
To: root@chaos.analogic.com, <simon@baydel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: unresolved symbols __udivdi3 and __umoddi3
Date: Mon, 28 Jan 2002 12:08:49 +0100	[thread overview]
Message-ID: <E16V9eb-00009M-00@starship.berlin> (raw)
In-Reply-To: <Pine.LNX.3.95.1020125114634.762A-100000@chaos.analogic.com>
In-Reply-To: <Pine.LNX.3.95.1020125114634.762A-100000@chaos.analogic.com>

On January 25, 2002 05:56 pm, Richard B. Johnson wrote:
> On Fri, 25 Jan 2002,  wrote:
> 
> > I am writing a module and would like to perform arithmetic on long 
> > long variables. When I try to do this the module does not load due
> > to the unresolved symbols __udivdi3 and __umoddi3. I notice these
> > are normally defined in libc. Is there any way I can do this in a 
> > kernel module.
> > 
> > Many Thanks
> > 
> > Simon.
> 
> Normally, in modules, the granularity is such that divisions can
> be made by powers-of-two. In a 32-bit world, the modulus that you
> obtain with umoddi3 (the remainder from a long-long, division) should
> normally fit within a 32-bit variable. If you insist upon doing 64-bit
> math in a 32-bit world, then you can either make your own procedures
> and link them, of you can "appropriate" them from the 'C' runtime
> library code, include them with your source, assemble, and link them
> in.

Let's be clear on one thing.  There is nothing unnatural about
32bits * 32bits = 64bits or 64bits / 32bits = 32bits in a 32 bit world.
In fact, it is a rare architecture that does not support this directly
in hardware.  It may be awkward to express it in C, but since when has
that ever stopped us from using the best machine instructions for the
job?

Personally, I find the omission of these mixed size muldiv operations
from the kernel a great inconvenience.  Think 'multiply by a ratio'.
Yes, I know that by various posturings you can force most problems
that would be most naturally be expressed this way into some other
form, but several things suffer:

  - Readability
  - Efficiency
  - Code complexity
  - Code size

I think the argument I've seen most often presented against mixed
size muldiv operations goes something like 'I've never used them, so
why would anybody need them?'.  This just means that somebody hasn't
written very many kinds of programs, particularly the kind of code
we need to write if we are ever going to get the VM and IO
balancing code working properly.

-- 
Daniel

  parent reply	other threads:[~2002-01-28 11:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-25  6:31 simon
2002-01-25 16:45 ` Andreas Dilger
2002-01-25 16:56 ` Richard B. Johnson
2002-01-25 21:42   ` Tim Schmielau
2002-01-28  4:21     ` simon
2002-01-28 17:38       ` Tim Schmielau
2002-01-28 19:17       ` Daniel Phillips
2002-01-28 19:28         ` Mark Zealey
2002-01-28 19:46         ` Momchil Velikov
2002-01-28 20:06           ` Daniel Phillips
2002-01-28 20:14             ` Momchil Velikov
2002-01-29 16:38             ` Horst von Brand
2002-01-30  8:09               ` Daniel Phillips
2002-01-30  8:43                 ` Jeff Garzik
2002-01-30  8:23               ` Jeff Garzik
2002-01-28 11:08   ` Daniel Phillips [this message]
2002-01-28 11:10     ` Arjan van de Ven
2002-01-28 11:47       ` Daniel Phillips
2002-01-25 17:06 ` christophe barbé
2002-01-25 18:53   ` Christoph Hellwig
2002-01-25 19:03     ` christophe barbé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E16V9eb-00009M-00@starship.berlin \
    --to=phillips@bonn-fries.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    --cc=simon@baydel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®