lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E833D27.50906@parallels.com>
Date:	Wed, 28 Sep 2011 12:28:39 -0300
From:	Glauber Costa <glommer@...allels.com>
To:	Martin Schwidefsky <schwidefsky@...ibm.com>
CC:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	<linux-kernel@...r.kernel.org>, <paul@...lmenage.org>,
	<lizf@...fujitsu.com>, <daniel.lezcano@...e.fr>,
	<jbottomley@...allels.com>,
	Heiko Carstens <heiko.carstens@...ibm.com>
Subject: Re: [RFD 4/9] Make total_forks per-cgroup

On 09/28/2011 09:42 AM, Martin Schwidefsky wrote:
> On Wed, 28 Sep 2011 12:35:24 +0200
> Peter Zijlstra<a.p.zijlstra@...llo.nl>  wrote:
>
>> On Wed, 2011-09-28 at 10:13 +0200, Martin Schwidefsky wrote:
>>> On Wed, 28 Sep 2011 00:00:37 +0200
>>> Peter Zijlstra<a.p.zijlstra@...llo.nl>  wrote:
>>>
>>>> On Fri, 2011-09-23 at 19:20 -0300, Glauber Costa wrote:
>>>>> @@ -1039,6 +1035,8 @@ static void posix_cpu_timers_init(struct task_struct *tsk)
>>>>>          INIT_LIST_HEAD(&tsk->cpu_timers[2]);
>>>>>   }
>>>>>
>>>>> +struct task_group *task_group(struct task_struct *p);
>>>>
>>>> That doesn't appear to be actually used in this file..
>>>>
>>>> Also, since there's already a for_each_possible_cpu() loop in that
>>>> proc/stat function, would it yield some code improvement to make
>>>> total_forks a cpu_usage_stat?
>>>>
>>>> I guess the whole cputime64_t crap gets in the way of that being
>>>> natural...
>>>>
>>>> We could of course kill off the cputime64_t thing, its pretty pointless
>>>> and its a u64 all over the board. I think Martin or Heiko created this
>>>> stuff (although I might be wrong, my git tree doesn't go back that far).
>>>
>>> The reason to introduce cputime_t has been that different architecture
>>> needed differently sized integers for their respective representation
>>> of cputime. On x86-32 the number of ticks is recorded in a u32, on s390
>>> we needed a u64 for the cpu timer values. cputime64_t is needed for
>>> cpustat and other sums of cputime that would overflow a cputime_t
>>> (in particular on x86-32 with the u32 cputime_t and the u64 cputime64_t).
>>>
>>> Now we would convert everything to u64 but that would cause x86-32 to
>>> use 64-bit arithmetic for the tick counter. If that is acceptable I
>>> can't say.
>>
>> Right, so the main point was about cputime64_t, we might as well use a
>> u64 for that throughout and ditch the silly cputime64_$op() accessors
>> and write normal code.
>>
>> But even if cputime_t differs between 32 and 64 bit machines, there is
>> no reason actually use cputime_add(), C can do this.
>>
>> The only reason to use things like cputime_add() is if you use a non
>> simple type, but that doesn't seem to be the case.
>>
>> So I think we can simplify the code lots by doing away with cputime64_t
>> and all the cputime_*() functions. We can keep cputime_t, or we can use
>> unsigned long, which I think will end up doing pretty much the same.
>>
>> That is, am I missing some added value of all this cputime*() foo?
>
> C can do the math as long as the encoding of the cputime is simple enough.
> Can we demand that a cputime value needs to be an integral type ?
>
> What I did when I wrote all that stuff is to define cputime_t as a struct
> that contains a single u64. That way I found all the places in the kernel
> that used a cputime and could convert the code accordingly.
>
> My fear is that if the cputime_xxx operations are removed, code will
> sneak in again that just uses an unsigned long instead of a cputime_t.
> That would break any arch that requires something bigger than a u32 for
> its cputime. I really have to find my old debugging patch and see if we
> already have bit rot in regard to cputime_t.
>
Martin,

Proposal is to keep cputime_t as is, and only get rid of its 
size-specific version. So I think we're safe as far as cputime_t is 
concerned.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ