Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • include
  • net
  • codel.h
Find file BlameHistoryPermalink
  • Eric Dumazet's avatar
    codel: use Newton method instead of sqrt() and divides · 536edd67
    Eric Dumazet authored May 12, 2012
    As Van pointed out, interval/sqrt(count) can be implemented using
    multiplies only.
    
    http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Iterative_methods_for_reciprocal_square_roots
    
    
    
    This patch implements the Newton method and reciprocal divide.
    
    Total cost is 15 cycles instead of 120 on my Corei5 machine (64bit
    kernel).
    
    There is a small 'error' for count values < 5, but we don't really care.
    
    I reuse a hole in struct codel_vars :
     - pack the dropping boolean into one bit
     - use 31bit to store the reciprocal value of sqrt(count).
    
    Suggested-by: default avatarVan Jacobson <van@pollere.net>
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Cc: Dave Taht <dave.taht@bufferbloat.net>
    Cc: Kathleen Nichols <nichols@pollere.com>
    Cc: Tom Herbert <therbert@google.com>
    Cc: Matt Mathis <mattmathis@google.com>
    Cc: Yuchung Cheng <ycheng@google.com>
    Cc: Nandita Dukkipati <nanditad@google.com>
    Cc: Stephen Hemminger <shemminger@vyatta.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    536edd67
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7