hadoop-yarn-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Miklos Szegedi (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (YARN-6852) [YARN-6223] Native code changes to support isolate GPU devices by using CGroups
Date Thu, 03 Aug 2017 03:39:00 GMT

    [ https://issues.apache.org/jira/browse/YARN-6852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16112127#comment-16112127
] 

Miklos Szegedi commented on YARN-6852:
--------------------------------------

…
Never mind about the function header comments above. I see them in the header.
{{// Make sure file exist}} There is a missing (s) at the end
{code}
f = fopen(full_path, "a");
{code}
Defense in depth: I would make sure full_path does not contain {{..}} For example {{/cgroups/cpu,cpuacct/container/../../../etc/passwd}}
{{if (fprintf(f, "%s", value) < 0)}} You do not close the file upon error of this call.
{code}
#ifdef __FreeBSD__
#define _WITH_GETLINE
#endif
{code}
Is this really needed in the Linux cgroups header file?
I think you do not need to include strings.h
parse_commandline_opts does not free opts and opts->keys, opts->values on error.
{{int input_argv_idx = 0;}} should be declared at the beginning of the file or inside braces
in standard C.
{{while (input_argv_idx < argc)}} could and probably should be replaced by for
{{int input_argv_idx = 0;}} the first argument is the process name. This should be {{int input_argv_idx
= 1;}}
{code}
opts->keys[opts->n_options] = param_name;
{code}
In general it is not a safe practice to return pointers inside argv. Consider a copy here.
opts->values is uninitialized. It may accidentally be dereferenced, so please fill it with
zeros first.
{{opts->keys = malloc(sizeof(char*) * (argc + 1));}} Why argc+1 and not argc-1?
required and has_values could be implemented as a bit array instead of a byte array. Another
option: Consider something like an array of 
{code}
struct known_parameter {char* name; struct {int required:1, int has_values:1 } flags;}
{code}
It saves 7 bytes per parameter.
continued...

> [YARN-6223] Native code changes to support isolate GPU devices by using CGroups
> -------------------------------------------------------------------------------
>
>                 Key: YARN-6852
>                 URL: https://issues.apache.org/jira/browse/YARN-6852
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>            Reporter: Wangda Tan
>            Assignee: Wangda Tan
>         Attachments: YARN-6852.001.patch, YARN-6852.002.patch
>
>
> This JIRA plan to add support of:
> 1) Isolation in CGroups. (native side).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-issues-help@hadoop.apache.org


Mime
View raw message