search for: roundup_64

Displaying 9 results from an estimated 9 matches for "roundup_64".

Did you mean: roundup64
2019 May 23
2
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
From: Steven Rostedt (VMware) <rostedt at goodmis.org> In discussing a build failure on x86_32 due to the use of roundup() on a 64 bit number, I realized that there's no generic equivalent roundup_64(). It is implemented in two separate places in the kernel, but there really should be just one that all can use. Although the other implementations are a static inline function, this implementation is a macro to allow the use of typeof(x) to denote the type that is being used. If the build is on a...
2019 May 23
4
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
On Thu, 23 May 2019 08:10:44 -0700 Linus Torvalds <torvalds at linux-foundation.org> wrote: > On Thu, May 23, 2019 at 7:00 AM Steven Rostedt <rostedt at goodmis.org> wrote: > > > > +# define roundup_64(x, y) ( \ > > +{ \ > > + typeof(y) __y = y; \ > > + typeof(x) __x = (x) + (__y - 1); \ > > + do_div(__x, __y);...
2019 May 23
0
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
On Thu, May 23, 2019 at 7:00 AM Steven Rostedt <rostedt at goodmis.org> wrote: > > +# define roundup_64(x, y) ( \ > +{ \ > + typeof(y) __y = y; \ > + typeof(x) __x = (x) + (__y - 1); \ > + do_div(__x, __y); \ > +...
2019 May 23
1
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
...e same time, in the case you are talking about, I really do > suspect that we have a (non-constant) power of two, and that you > should have just used "round_up()" which works fine regardless of > size, and is always efficient. I think you are correct in this. act_size = roundup_64(attr->length, MLX5_SW_ICM_BLOCK_SIZE(dm_db->dev)); Where we have: #define MLX5_SW_ICM_BLOCK_SIZE(dev) (1 << MLX5_LOG_SW_ICM_BLOCK_SIZE(dev)) Which pretty much guarantees that it is a power of two. Thus, the real fix here is simply to s/roundup/round_up/ as you suggest. > > On...
2019 May 23
0
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
On Thu, May 23, 2019 at 8:27 AM Steven Rostedt <rostedt at goodmis.org> wrote: > > I haven't yet tested this, but what about something like the following: So that at least handles the constant case that the normal "roundup()" case also handles. At the same time, in the case you are talking about, I really do suspect that we have a (non-constant) power of two, and that
2019 May 24
0
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
On Fri, 24 May 2019 16:11:14 +0100 Roger Willcocks <roger at filmlight.ltd.uk> wrote: > On 23/05/2019 16:27, Steven Rostedt wrote: > > > > I haven't yet tested this, but what about something like the following: > > > > ...perhaps forget about the constant check, and just force > > the power of two check: > > > > \ > > if (!(__y
2019 May 24
0
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
On Fri, 24 May 2019 19:30:45 +0300 Nikolay Borisov <nborisov at suse.com> wrote: > > Yes I do. I corrected it in my next email. > > > > http://lkml.kernel.org/r/20190523133648.591f9e78 at gandalf.local.home > > Or perhaps just using is_power_of_2 from include/linux/log2.h ? Even better. Thanks, -- Steve
2019 May 24
1
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
On 23/05/2019 16:27, Steven Rostedt wrote: > > I haven't yet tested this, but what about something like the following: > > ...perhaps forget about the constant check, and just force > the power of two check: > > \ > if (!(__y & (__y >> 1))) { \ > __x = round_up(x, y); \ > } else { \ You probably want            if (!(__y & (__y
2019 May 24
1
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
On 24.05.19 г. 18:26 ч., Steven Rostedt wrote: > On Fri, 24 May 2019 16:11:14 +0100 > Roger Willcocks <roger at filmlight.ltd.uk> wrote: > >> On 23/05/2019 16:27, Steven Rostedt wrote: >>> >>> I haven't yet tested this, but what about something like the following: >>> >>> ...perhaps forget about the constant check, and just force