> > 3 files changed, 404 insertions(+), 377 deletions(-)
>
> Not a fan of this. The atomic_ops.txt file needs a lot of love, and I
> wouldn't want to edit a .rst file.
What is the problem with this rst-file? atomic_ops.rst are not so different
sertions(+), 377 deletions(-)
>
> Not a fan of this. The atomic_ops.txt file needs a lot of love, and I
> wouldn't want to edit a .rst file.
What is the problem with this rst-file? atomic_ops.rst are not so different to
the txt variant.
I will drop this patch.
Best regards,
Silvi
gt; > +
> > +.. code-block:: c
>
> Better to use :: instead of code-block.
>
> > +
> > +/* test-local.c
> > + *
> > + * Sample module for local.h usage.
> > + */
> > +
> > +
> > +#include
> > +#include
> > +#include
> > +
> > +static DEFINE_PER_CPU(local_t, counters) = LOCAL_INIT(0);
> > +
> > +static struct timer_list test_timer;
> > +
> > +/* IPI called on each CPU. */
> > +static void test_each(void *info)
> > +{
> > +/* Increment the counter from a non preemptible context */
> > +printk("Increment on cpu %d\n", smp_processor_id());
> > +local_inc(this_cpu_ptr());
> > +
> > +/* This is what incrementing the variable would look like
> > within a
> > + * preemptible context (it disables preemption) :
> > + *
> > + * local_inc(_cpu_var(counters));
> > + * put_cpu_var(counters);
> > + */
> > +}
> > +
> > +static void do_test_timer(unsigned long data)
> > +{
> > +int cpu;
> > +
> > +/* Increment the counters */
> > +on_each_cpu(test_each, NULL, 1);
> > +/* Read all the counters */
> > +printk("Counters read from CPU %d\n", smp_processor_id());
> > +for_each_online_cpu(cpu) {
> > +printk("Read : CPU %d, count %ld\n", cpu,
> > +local_read(_cpu(counters, cpu)));
> > +}
> > +del_timer(_timer);
> > +test_timer.expires = jiffies + 1000;
> > +add_timer(_timer);
> > +}
> > +
> > +static int __init test_init(void)
> > +{
> > +/* initialize the timer that will increment the counter */
> > +init_timer(_timer);
> > +test_timer.function = do_test_timer;
> > +test_timer.expires = jiffies + 1;
> > +add_timer(_timer);
> > +
> > +return 0;
> > +}
> > +
> > +static void __exit test_exit(void)
> > +{
> > +del_timer_sync(_timer);
> > +}
> > +
> > +module_init(test_init);
> > +module_exit(test_exit);
> > +
> > +MODULE_LICENSE("GPL");
> > +MODULE_AUTHOR("Mathieu Desnoyers");
> > +MODULE_DESCRIPTION("Local Atomic Ops");
>
>
>
> Thanks,
> Mauro
--
-- S. Fricke sil...@port1024.net --
Diplom-Informatiker (FH)
Linux-Development Matrix: @silvio:port1024.net
se :: instead of code-block.
>
> > +
> > + /* test-local.c
> > + *
> > + * Sample module for local.h usage.
> > + */
> > +
> > +
> > +#include
> > +#include
> > +#include
> > +
> > +static DEFINE_PER_CPU(local_t, counters) = LOCAL_INIT(0);
> > +
> > +static struct timer_list test_timer;
> > +
> > +/* IPI called on each CPU. */
> > +static void test_each(void *info)
> > +{
> > +/* Increment the counter from a non preemptible context */
> > +printk("Increment on cpu %d\n", smp_processor_id());
> > +local_inc(this_cpu_ptr());
> > +
> > +/* This is what incrementing the variable would look like
> > within a
> > + * preemptible context (it disables preemption) :
> > + *
> > + * local_inc(_cpu_var(counters));
> > + * put_cpu_var(counters);
> > + */
> > +}
> > +
> > +static void do_test_timer(unsigned long data)
> > +{
> > +int cpu;
> > +
> > +/* Increment the counters */
> > +on_each_cpu(test_each, NULL, 1);
> > +/* Read all the counters */
> > +printk("Counters read from CPU %d\n", smp_processor_id());
> > +for_each_online_cpu(cpu) {
> > +printk("Read : CPU %d, count %ld\n", cpu,
> > +local_read(_cpu(counters, cpu)));
> > +}
> > +del_timer(_timer);
> > +test_timer.expires = jiffies + 1000;
> > +add_timer(_timer);
> > +}
> > +
> > +static int __init test_init(void)
> > +{
> > +/* initialize the timer that will increment the counter */
> > +init_timer(_timer);
> > +test_timer.function = do_test_timer;
> > +test_timer.expires = jiffies + 1;
> > +add_timer(_timer);
> > +
> > +return 0;
> > +}
> > +
> > +static void __exit test_exit(void)
> > +{
> > +del_timer_sync(_timer);
> > +}
> > +
> > +module_init(test_init);
> > +module_exit(test_exit);
> > +
> > +MODULE_LICENSE("GPL");
> > +MODULE_AUTHOR("Mathieu Desnoyers");
> > +MODULE_DESCRIPTION("Local Atomic Ops");
>
>
>
> Thanks,
> Mauro
--
-- S. Fricke sil...@port1024.net --
Diplom-Informatiker (FH)
Linux-Development Matrix: @silvio:port1024.net
4 matches
Mail list logo