Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default MemorySwappiness when adapt #18285

Merged
merged 2 commits into from
Dec 2, 2015
Merged

Conversation

hqhq
Copy link
Contributor

@hqhq hqhq commented Nov 28, 2015

It makes the inspect result consistent between cli and REST api
when MemorySwappiness is not set.

Signed-off-by: Qiang Huang [email protected]

@runcom
Copy link
Member

runcom commented Nov 28, 2015

Tests failures seems related

@hqhq hqhq force-pushed the hq_fix_swappiness branch 2 times, most recently from b05be86 to df82400 Compare November 30, 2015 08:45
@hqhq
Copy link
Contributor Author

hqhq commented Nov 30, 2015

@runcom Updated.

@estesp
Copy link
Contributor

estesp commented Nov 30, 2015

ping @vieux : does this fix the issue you mentioned recently re: memoryswappiness default?

@cpuguy83
Copy link
Member

This is not the first time we've gone through such a change on this field.

@hqhq
Copy link
Contributor Author

hqhq commented Dec 1, 2015

@cpuguy83 What change exactly are you mentioning? I know this field used to be int64 and was changed to *int64, but this PR is more like a fix instead of a change. WDYT?

@cpuguy83
Copy link
Member

cpuguy83 commented Dec 1, 2015

Changing the defaults for MemorySwapiness -- just pointing out this has been a problem multiple times.

@runcom
Copy link
Member

runcom commented Dec 1, 2015

I think the default if not provided will default to -1 as it was previously. This patch just move the initialization to -1 back in the code path right @hqhq?

@estesp
Copy link
Contributor

estesp commented Dec 1, 2015

More correctly, it handles non-Docker clients (e.g. API users like swarm/compose) from causing "unset" to translate to 0, rather than "unset" -> -1, which is what should happen. I think most of the confusion was around catching all the places that instantiation was performed and making sure default != 0, given 0 is a setting, not a default in this case.

@estesp
Copy link
Contributor

estesp commented Dec 1, 2015

sorry @hqhq ..this needs a rebase now

@hqhq hqhq force-pushed the hq_fix_swappiness branch from df82400 to 2f62f9a Compare December 2, 2015 01:27
@hqhq
Copy link
Contributor Author

hqhq commented Dec 2, 2015

@estesp was right, this PR will fix problem like docker-archive/classicswarm#1411
The problem we have before was when user used REST API, the default value for swappiness is not set to container's hostConfig, only set to container.command and passed to libcontainer, which will cause problem like the swarm issue.

@runcom @estesp Rebased.

It makes the inspect result consistent between cli and REST api
when MemorySwappiness is not set.

Signed-off-by: Qiang Huang <[email protected]>
@hqhq hqhq force-pushed the hq_fix_swappiness branch from 2f62f9a to 4089b4e Compare December 2, 2015 03:53
@jimmyxian
Copy link
Contributor

@hqhq Thanks for doing this.
I think we need set swappiness default value -1 in docker daemon side.

ping @vieux

@thaJeztah
Copy link
Member

@hqhq @jimmyxian was this issue introduced in docker 1.9 in Swarm, or already present in docker 1.8.3? Asking so that we can decide if this should be considered for a 1.9.2 release (if we decide to release that)

@hqhq
Copy link
Contributor Author

hqhq commented Dec 2, 2015

@thaJeztah It's exist since Docker v1.5

@runcom
Copy link
Member

runcom commented Dec 2, 2015

I think my PR #18261 will be also affected by having adaptContainerSettings always called? Is this correct @hqhq ?

@hqhq
Copy link
Contributor Author

hqhq commented Dec 2, 2015

@runcom Yeah, you can see I changed your test cases. You expected API without hostConfig (or just without these fields) has nil for these pointer fields, while CLI without these options has default value (not nil). Are there any specific reasons that I missed? I think it's better to make them consistent. And the reason we want API got the same default value is the same as we want CLI got the default.

@runcom
Copy link
Member

runcom commented Dec 2, 2015

@hqhq perfect

@estesp
Copy link
Contributor

estesp commented Dec 2, 2015

LGTM

1 similar comment
@cpuguy83
Copy link
Member

cpuguy83 commented Dec 2, 2015

LGTM

cpuguy83 added a commit that referenced this pull request Dec 2, 2015
Set default MemorySwappiness when adapt
@cpuguy83 cpuguy83 merged commit f411b10 into moby:master Dec 2, 2015
@thaJeztah
Copy link
Member

@estesp @cpuguy83 sorry, I lost track of all the "default value" changes; is this an user-facing change in the API? If so, can you add the right impact labels?

@estesp
Copy link
Contributor

estesp commented Dec 2, 2015

I don't believe there is any need for API or user-facing impact--this is really a bug fix for a hole in the setup of containers via certain paths which weren't defaulting properly to the "unset" value (a pointer to -1 in this case), meaning they were getting "default to zero" as a setting for swappiness, which is an actual swappiness value, which of course is a bug unless the user asked for swappiness = 0.

@thaJeztah
Copy link
Member

Thanks for checking @estesp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants