[PATCH] libblock: Do resource allocation in one place
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Feb 21 08:49:59 UTC 2013
On 02/21/2013 03:56 AM, Chris Johns wrote:
> Sebastian Huber wrote:
>>
>> - /*
>> - * Create the worker threads.
>> - */
>> - rtems_bdbuf_swapout_workers_open ();
>> -
>
> Why the need to move this to the bdbuf init ? The worker threads are part of
> the implementation of the swapout task. This abstraction is being removed.
The usage of worker threads is part of the configuration. If we allocate all
resources in rtems_bdbuf_init() we have consistent behaviour. The
initialization may be either successful or a failure and nothing else. If we
postpone the swapout and worker thread initialization the success is
unpredictable and may lead to fatal system errors depending on the state of the
overall application.
>>
>> dev_t dev = 0;
>>
>> -static void initialize_swapout_task(void)
>> -{
>> - int fd = open(RAMDISK_PATH, O_RDONLY);
>> - int rv = 0;
>> -
>> - rtems_test_assert(fd>= 0);
>> -
>> - rv = rtems_disk_fd_sync(fd);
>> - rtems_test_assert(rv == 0);
>> -
>> - rv = close(fd);
>> - rtems_test_assert(rv == 0);
>> -}
>
> I do not understand why this call is needed. What is it working around ?
This was necessary to force the swapout task initialization. Without this you
cannot check the resource usage with rtems_resource_snapshot_take() etc.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list