Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1560603 > unrolled thread
| Started by | Michal Hocko <mhocko@kernel.org> |
|---|---|
| First post | 2017-01-17 15:00 +0100 |
| Last post | 2017-01-24 14:00 +0100 |
| Articles | 20 on this page of 24 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Michal Hocko <mhocko@kernel.org> - 2017-01-17 15:00 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Mel Gorman <mgorman@techsingularity.net> - 2017-01-17 15:30 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Michal Hocko <mhocko@kernel.org> - 2017-01-17 16:00 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Trevor Cordes <trevor@tecnopolis.ca> - 2017-01-18 08:30 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Mel Gorman <mgorman@techsingularity.net> - 2017-01-18 18:50 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Mel Gorman <mgorman@techsingularity.net> - 2017-01-18 19:10 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Trevor Cordes <trevor@tecnopolis.ca> - 2017-01-19 10:50 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Michal Hocko <mhocko@kernel.org> - 2017-01-19 12:40 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Trevor Cordes <trevor@tecnopolis.ca> - 2017-01-20 07:40 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Mel Gorman <mgorman@techsingularity.net> - 2017-01-20 12:10 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Mel Gorman <mgorman@techsingularity.net> - 2017-01-20 17:00 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Mel Gorman <mgorman@techsingularity.net> - 2017-01-23 11:50 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Mel Gorman <mgorman@techsingularity.net> - 2017-01-23 12:10 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Michal Hocko <mhocko@kernel.org> - 2017-01-25 10:50 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Michal Hocko <mhocko@kernel.org> - 2017-01-24 14:00 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Trevor Cordes <trevor@tecnopolis.ca> - 2017-01-25 11:30 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Michal Hocko <mhocko@kernel.org> - 2017-01-25 13:10 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Trevor Cordes <trevor@tecnopolis.ca> - 2017-01-30 00:00 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Michal Hocko <mhocko@kernel.org> - 2017-01-30 09:00 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Mel Gorman <mgorman@techsingularity.net> - 2017-01-30 10:20 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Michal Hocko <mhocko@kernel.org> - 2017-01-24 14:00 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Trevor Cordes <trevor@tecnopolis.ca> - 2017-01-27 00:20 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Michal Hocko <mhocko@kernel.org> - 2017-01-27 08:40 +0100
Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) Michal Hocko <mhocko@kernel.org> - 2017-01-24 14:00 +0100
Page 1 of 2 [1] 2 Next page →
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-01-17 15:00 +0100 |
| Subject | Re: mm, vmscan: commit makes PAE kernel crash nightly (bisected) |
| Message-ID | <t0CsO-7MA-35@gated-at.bofh.it> |
On Mon 16-01-17 11:09:34, Mel Gorman wrote: [...] > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 532a2a750952..46aac487b89a 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2684,6 +2684,7 @@ static void shrink_zones(struct zonelist *zonelist, struct scan_control *sc) > continue; > > if (sc->priority != DEF_PRIORITY && > + !buffer_heads_over_limit && > !pgdat_reclaimable(zone->zone_pgdat)) > continue; /* Let kswapd poll it */ I think we should rather remove pgdat_reclaimable here. This sounds like a wrong layer to decide whether we want to reclaim and how much. But even that won't help very much I am afraid. As I've noted in the other response as long as we will scale the slab shrinking based on nr_scanned we will have a problem with situations where slab outnumbers lru lists too much. I do not have a good idea how to fix that though... -- Michal Hocko SUSE Labs
[toc] | [next] | [standalone]
| From | Mel Gorman <mgorman@techsingularity.net> |
|---|---|
| Date | 2017-01-17 15:30 +0100 |
| Message-ID | <t0CVQ-8bo-21@gated-at.bofh.it> |
| In reply to | #1560603 |
On Tue, Jan 17, 2017 at 02:52:28PM +0100, Michal Hocko wrote: > On Mon 16-01-17 11:09:34, Mel Gorman wrote: > [...] > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > index 532a2a750952..46aac487b89a 100644 > > --- a/mm/vmscan.c > > +++ b/mm/vmscan.c > > @@ -2684,6 +2684,7 @@ static void shrink_zones(struct zonelist *zonelist, struct scan_control *sc) > > continue; > > > > if (sc->priority != DEF_PRIORITY && > > + !buffer_heads_over_limit && > > !pgdat_reclaimable(zone->zone_pgdat)) > > continue; /* Let kswapd poll it */ > > I think we should rather remove pgdat_reclaimable here. This sounds like > a wrong layer to decide whether we want to reclaim and how much. > I had considered that but it'd also be important to add the other 32-bit patches you have posted to see the impact. Because of the ratio of LRU pages to slab pages, it may not have an impact but it'd need to be eliminated. > But even that won't help very much I am afraid. As I've noted in the > other response as long as we will scale the slab shrinking based on > nr_scanned we will have a problem with situations where slab outnumbers > lru lists too much. I do not have a good idea how to fix that though... > Right now, I don't either other than a heavy-handed approach of checking if a) it's a pgdat with a highmem node b) if the ratio of LRU pages to slab pages on the lower zones is out of whack and if so, ignore nr_scanned for the slab shrinker. Before prototyping such a thing, I'd like to hear the outcome of this heavy hack and then add your 32-bit patches onto the list. If the problem is still there then I'd next look at taking slab pages into account in pgdat_reclaimable() instead of an outright removal that has a much wider impact. If that doesn't work then I'll prototype a heavy-handed forced slab reclaim when lower zones are almost all slab pages. -- Mel Gorman SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-01-17 16:00 +0100 |
| Message-ID | <t0DoS-8lp-1@gated-at.bofh.it> |
| In reply to | #1560640 |
On Tue 17-01-17 14:21:14, Mel Gorman wrote: > On Tue, Jan 17, 2017 at 02:52:28PM +0100, Michal Hocko wrote: > > On Mon 16-01-17 11:09:34, Mel Gorman wrote: > > [...] > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > index 532a2a750952..46aac487b89a 100644 > > > --- a/mm/vmscan.c > > > +++ b/mm/vmscan.c > > > @@ -2684,6 +2684,7 @@ static void shrink_zones(struct zonelist *zonelist, struct scan_control *sc) > > > continue; > > > > > > if (sc->priority != DEF_PRIORITY && > > > + !buffer_heads_over_limit && > > > !pgdat_reclaimable(zone->zone_pgdat)) > > > continue; /* Let kswapd poll it */ > > > > I think we should rather remove pgdat_reclaimable here. This sounds like > > a wrong layer to decide whether we want to reclaim and how much. > > > > I had considered that but it'd also be important to add the other 32-bit > patches you have posted to see the impact. Because of the ratio of LRU pages > to slab pages, it may not have an impact but it'd need to be eliminated. OK, Trevor you can pull from git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git tree fixes/highmem-node-fixes branch. This contains the current mmotm tree + the latest highmem fixes. I also do not expect this would help much in your case but as Mel've said we should rule that out at least. > Right now, I don't either other than a heavy-handed approach of checking if > a) it's a pgdat with a highmem node I do not think this is a right approach because we have a similar problem even without the highmem. I have already seen cases where the slab memory has eaten the whole DMA32 zone. > b) if the ratio of LRU pages to slab > pages on the lower zones is out of whack and if so, ignore nr_scanned for > the slab shrinker. this sounds much more promissing. > Before prototyping such a thing, I'd like to hear the outcome of this > heavy hack and then add your 32-bit patches onto the list. If the problem > is still there then I'd next look at taking slab pages into account in > pgdat_reclaimable() instead of an outright removal that has a much wider > impact. If that doesn't work then I'll prototype a heavy-handed forced > slab reclaim when lower zones are almost all slab pages. I would be really curious to hear whether pgdat_reclaimable removal makes any bad side effects. It just smells wrong from a highlevel point of view. Besides that I really _hate_ pgdat_reclaimable for any decision making. It just behaves very randomly... I do not expect it help much in this case, though, as the highmem can easily bias the decision. -- Michal Hocko SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Trevor Cordes <trevor@tecnopolis.ca> |
|---|---|
| Date | 2017-01-18 08:30 +0100 |
| Message-ID | <t0SQW-16l-7@gated-at.bofh.it> |
| In reply to | #1560669 |
On 2017-01-17 Michal Hocko wrote: > On Tue 17-01-17 14:21:14, Mel Gorman wrote: > > On Tue, Jan 17, 2017 at 02:52:28PM +0100, Michal Hocko wrote: > > > On Mon 16-01-17 11:09:34, Mel Gorman wrote: > > > [...] > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > > index 532a2a750952..46aac487b89a 100644 > > > > --- a/mm/vmscan.c > > > > +++ b/mm/vmscan.c > > > > @@ -2684,6 +2684,7 @@ static void shrink_zones(struct zonelist > > > > *zonelist, struct scan_control *sc) continue; > > > > > > > > if (sc->priority != DEF_PRIORITY && > > > > + !buffer_heads_over_limit && > > > > !pgdat_reclaimable(zone->zone_pgdat)) > > > > continue; /* Let kswapd > > > > poll it */ > > > > > > I think we should rather remove pgdat_reclaimable here. This > > > sounds like a wrong layer to decide whether we want to reclaim > > > and how much. > > > > I had considered that but it'd also be important to add the other > > 32-bit patches you have posted to see the impact. Because of the > > ratio of LRU pages to slab pages, it may not have an impact but > > it'd need to be eliminated. > > OK, Trevor you can pull from > git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git tree > fixes/highmem-node-fixes branch. This contains the current mmotm tree > + the latest highmem fixes. I also do not expect this would help much > in your case but as Mel've said we should rule that out at least. OK, ignore my last question re: what to do next. I am building this mhocko git tree now per your above instructions and will reboot into it in a few hours with*out* the cgroup_disable=memory option. Might take ~50 hours for a result. I should note that the workload on the box with the bug is mostly as a file server and iptables firewall/router. It routes around 8GB(ytes) a day, and periodic file server loads. That's about it. Everything else that is running is not doing much, and not using much RAM; except maybe clamav, by far the biggest RAM. I don't see this bug on other nearly identical boxes, including: F24 4.8.15 32-bit (no PAE) 1GB ram P4 F24 4.8.15 32-bit (no PAE) 2GB ram Core2 Quad However, just noticed for the first time today that one other box is also seeing this bug (gets an oom message), though with much less frequency: twice in 2 months since upgrading to 4.8. However, it recovers from the oom without a reboot and hasn't hanged (yet). That could be because this box does not do as much file serving or I/O as the one I've been building/testing on. Also, this box is a much older Pentium-D with 4GB (PAE on). If it would be helpful to see its oom log, let me know. (Scanning all my boxes now, I also found 1 single oom on yet another 1 computer with the same story; but this is a Xeon E3-1220 32-bit with PAE, 4GB.) So far the commonality seems to be >2GB RAM and PAE on. Might be interesting to boot my build/test box with mem=2G and isolate it to small RAM vs PAE. "mem=2G" would make a great, easy, immediate workaround for this problem for me (as cgroup_disable=memory also seems to do, so far). Thanks!
[toc] | [prev] | [next] | [standalone]
| From | Mel Gorman <mgorman@techsingularity.net> |
|---|---|
| Date | 2017-01-18 18:50 +0100 |
| Message-ID | <t12wV-72O-19@gated-at.bofh.it> |
| In reply to | #1560669 |
On Tue, Jan 17, 2017 at 03:54:51PM +0100, Michal Hocko wrote: > On Tue 17-01-17 14:21:14, Mel Gorman wrote: > > On Tue, Jan 17, 2017 at 02:52:28PM +0100, Michal Hocko wrote: > > > On Mon 16-01-17 11:09:34, Mel Gorman wrote: > > > [...] > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > > index 532a2a750952..46aac487b89a 100644 > > > > --- a/mm/vmscan.c > > > > +++ b/mm/vmscan.c > > > > @@ -2684,6 +2684,7 @@ static void shrink_zones(struct zonelist *zonelist, struct scan_control *sc) > > > > continue; > > > > > > > > if (sc->priority != DEF_PRIORITY && > > > > + !buffer_heads_over_limit && > > > > !pgdat_reclaimable(zone->zone_pgdat)) > > > > continue; /* Let kswapd poll it */ > > > > > > I think we should rather remove pgdat_reclaimable here. This sounds like > > > a wrong layer to decide whether we want to reclaim and how much. > > > > > > > I had considered that but it'd also be important to add the other 32-bit > > patches you have posted to see the impact. Because of the ratio of LRU pages > > to slab pages, it may not have an impact but it'd need to be eliminated. > > OK, Trevor you can pull from > git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git tree > fixes/highmem-node-fixes branch. This contains the current mmotm tree + > the latest highmem fixes. I also do not expect this would help much in > your case but as Mel've said we should rule that out at least. > After considering slab shrinking of lower nodes, it occurs to me that your fixes also impacts slab shrinking. For lowmem-constrained allocations, we accounted for scans on the lower zones but shrunk slabs proportional to the total LRU size. If the lower zones had few LRU pages and were mostly slab pages then the proportional calculation would be way off. This may have a bigger impact on Trevor Cordes' situation that I had imagined at the start of today. -- Mel Gorman SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Mel Gorman <mgorman@techsingularity.net> |
|---|---|
| Date | 2017-01-18 19:10 +0100 |
| Message-ID | <t12Qj-7py-37@gated-at.bofh.it> |
| In reply to | #1560669 |
On Tue, Jan 17, 2017 at 03:54:51PM +0100, Michal Hocko wrote: > On Tue 17-01-17 14:21:14, Mel Gorman wrote: > > On Tue, Jan 17, 2017 at 02:52:28PM +0100, Michal Hocko wrote: > > > On Mon 16-01-17 11:09:34, Mel Gorman wrote: > > > [...] > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > > index 532a2a750952..46aac487b89a 100644 > > > > --- a/mm/vmscan.c > > > > +++ b/mm/vmscan.c > > > > @@ -2684,6 +2684,7 @@ static void shrink_zones(struct zonelist *zonelist, struct scan_control *sc) > > > > continue; > > > > > > > > if (sc->priority != DEF_PRIORITY && > > > > + !buffer_heads_over_limit && > > > > !pgdat_reclaimable(zone->zone_pgdat)) > > > > continue; /* Let kswapd poll it */ > > > > > > I think we should rather remove pgdat_reclaimable here. This sounds like > > > a wrong layer to decide whether we want to reclaim and how much. > > > > > > > I had considered that but it'd also be important to add the other 32-bit > > patches you have posted to see the impact. Because of the ratio of LRU pages > > to slab pages, it may not have an impact but it'd need to be eliminated. > > OK, Trevor you can pull from > git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git tree > fixes/highmem-node-fixes branch. This contains the current mmotm tree + > the latest highmem fixes. I also do not expect this would help much in > your case but as Mel've said we should rule that out at least. > After considering slab shrinking of lower nodes, it occured to me that your fixes may have a bigger impact than I believed this morning. For lowmem-constrained allocations, we account for scans on the lower zones but shrink proportionally to the LRU size for the entire node. If the lower zones had few LRU pages and were mostly slab pages then the proportional calculation would be way off so direct reclaim would barely touch slab caches. That is fixed up by "mm, vmscan: consider eligible zones in get_scan_count" so that the slab shrinking will be proportional to the LRU pages on the lower zones. -- Mel Gorman SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Trevor Cordes <trevor@tecnopolis.ca> |
|---|---|
| Date | 2017-01-19 10:50 +0100 |
| Message-ID | <t1hvY-8e7-25@gated-at.bofh.it> |
| In reply to | #1560669 |
On 2017-01-17 Michal Hocko wrote: > On Tue 17-01-17 14:21:14, Mel Gorman wrote: > > On Tue, Jan 17, 2017 at 02:52:28PM +0100, Michal Hocko wrote: > > > On Mon 16-01-17 11:09:34, Mel Gorman wrote: > > > [...] > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > > index 532a2a750952..46aac487b89a 100644 > > > > --- a/mm/vmscan.c > > > > +++ b/mm/vmscan.c > > > > @@ -2684,6 +2684,7 @@ static void shrink_zones(struct zonelist > > > > *zonelist, struct scan_control *sc) continue; > > > > > > > > if (sc->priority != DEF_PRIORITY && > > > > + !buffer_heads_over_limit && > > > > !pgdat_reclaimable(zone->zone_pgdat)) > > > > continue; /* Let kswapd > > > > poll it */ > > > > > > I think we should rather remove pgdat_reclaimable here. This > > > sounds like a wrong layer to decide whether we want to reclaim > > > and how much. > > > > I had considered that but it'd also be important to add the other > > 32-bit patches you have posted to see the impact. Because of the > > ratio of LRU pages to slab pages, it may not have an impact but > > it'd need to be eliminated. > > OK, Trevor you can pull from > git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git tree > fixes/highmem-node-fixes branch. This contains the current mmotm tree > + the latest highmem fixes. I also do not expect this would help much > in your case but as Mel've said we should rule that out at least. Hi! The git tree above version oom'd after < 24 hours (3:02am) so it doesn't solve the bug. If you need a oom messages dump let me know. Let me know what to try next, guys, and I'll test it out. > > Before prototyping such a thing, I'd like to hear the outcome of > > this heavy hack and then add your 32-bit patches onto the list. If > > the problem is still there then I'd next look at taking slab pages > > into account in pgdat_reclaimable() instead of an outright removal > > that has a much wider impact. If that doesn't work then I'll > > prototype a heavy-handed forced slab reclaim when lower zones are > > almost all slab pages. I don't think I've tried the "heavy hack" patch yet? It's not in the mhocko tree I just tried? Should I try the heavy hack on top of mhocko git or on vanilla or what? I also want to mention that these PAE boxes suffer from another problem/bug that I've worked around for almost a year now. For some reason it keeps gnawing at me that it might be related. The disk I/O goes to pot on this/these PAE boxes after a certain amount of disk writes (like some unknown number of GB, around 10-ish maybe). Like writes go from 500MB/s to 10MB/s!! Reboot and it's magically 500MB/s again. I detail this here: https://muug.ca/pipermail/roundtable/2016-June/004669.html My fix was to mem=XG where X is <8 (like 4 or 6) to force the PAE kernel to be more sane about highmem choices. I never filed a bug because I read a ton of stuff saying Linus hates PAE, don't use over 4G, blah blah. But the other fix is to: set /proc/sys/vm/highmem_is_dirtyable to 1 I'm not bringing this up to get attention to a new bug, I bring this up because it smells like it might be related. If something slowly eats away at the box's vm to the point that I/O gets horribly slow, perhaps it's related to the slab and high/lomem issue we have here? And if related, it may help to solve the oom bug. If I'm way off base here, just ignore my tangent! The funny thing is I thought mem=XG where X<8 solved the problem, but it doesn't! It greatly mitigates it, but I still get subtle slowdown that gets worse over time (like weeks instead of days). I now use the highmem_is_dirtyable on most boxes and that seems to solve it for good in combo with mem=XG. Let me note, however, that I have NOT set highmem_is_dirtyable=1 on the test box I am using for all of this building/testing, as I wanted the config to stay static while I work through this oom bug. (I'm real curious to see if highmem_is_dirtyable=1 would have any impact on the oom though!) Thanks!
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-01-19 12:40 +0100 |
| Message-ID | <t1jeq-X3-5@gated-at.bofh.it> |
| In reply to | #1562532 |
On Thu 19-01-17 03:48:50, Trevor Cordes wrote: > On 2017-01-17 Michal Hocko wrote: > > On Tue 17-01-17 14:21:14, Mel Gorman wrote: > > > On Tue, Jan 17, 2017 at 02:52:28PM +0100, Michal Hocko wrote: > > > > On Mon 16-01-17 11:09:34, Mel Gorman wrote: > > > > [...] > > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > > > index 532a2a750952..46aac487b89a 100644 > > > > > --- a/mm/vmscan.c > > > > > +++ b/mm/vmscan.c > > > > > @@ -2684,6 +2684,7 @@ static void shrink_zones(struct zonelist > > > > > *zonelist, struct scan_control *sc) continue; > > > > > > > > > > if (sc->priority != DEF_PRIORITY && > > > > > + !buffer_heads_over_limit && > > > > > !pgdat_reclaimable(zone->zone_pgdat)) > > > > > continue; /* Let kswapd > > > > > poll it */ > > > > > > > > I think we should rather remove pgdat_reclaimable here. This > > > > sounds like a wrong layer to decide whether we want to reclaim > > > > and how much. > > > > > > I had considered that but it'd also be important to add the other > > > 32-bit patches you have posted to see the impact. Because of the > > > ratio of LRU pages to slab pages, it may not have an impact but > > > it'd need to be eliminated. > > > > OK, Trevor you can pull from > > git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git tree > > fixes/highmem-node-fixes branch. This contains the current mmotm tree > > + the latest highmem fixes. I also do not expect this would help much > > in your case but as Mel've said we should rule that out at least. > > Hi! The git tree above version oom'd after < 24 hours (3:02am) so > it doesn't solve the bug. If you need a oom messages dump let me know. Yes please. > Let me know what to try next, guys, and I'll test it out. > > > > Before prototyping such a thing, I'd like to hear the outcome of > > > this heavy hack and then add your 32-bit patches onto the list. If > > > the problem is still there then I'd next look at taking slab pages > > > into account in pgdat_reclaimable() instead of an outright removal > > > that has a much wider impact. If that doesn't work then I'll > > > prototype a heavy-handed forced slab reclaim when lower zones are > > > almost all slab pages. > > I don't think I've tried the "heavy hack" patch yet? It's not in the > mhocko tree I just tried? Should I try the heavy hack on top of mhocko > git or on vanilla or what? > > I also want to mention that these PAE boxes suffer from another > problem/bug that I've worked around for almost a year now. For some > reason it keeps gnawing at me that it might be related. The disk I/O > goes to pot on this/these PAE boxes after a certain amount of disk > writes (like some unknown number of GB, around 10-ish maybe). Like > writes go from 500MB/s to 10MB/s!! Reboot and it's magically 500MB/s > again. I detail this here: > https://muug.ca/pipermail/roundtable/2016-June/004669.html > My fix was to mem=XG where X is <8 (like 4 or 6) to force the PAE > kernel to be more sane about highmem choices. I never filed a bug > because I read a ton of stuff saying Linus hates PAE, don't use over > 4G, blah blah. But the other fix is to: > set /proc/sys/vm/highmem_is_dirtyable to 1 Yes this sounds like a dirty memory throttling and there were some changes in that area. I do not remember when exactly. > I'm not bringing this up to get attention to a new bug, I bring this up > because it smells like it might be related. If something slowly eats > away at the box's vm to the point that I/O gets horribly slow, perhaps > it's related to the slab and high/lomem issue we have here? And if > related, it may help to solve the oom bug. If I'm way off base here, > just ignore my tangent! From your OOM reports so far it doesn't really seem related because you never had large number of pages under the writeback when OOM. The situation with the PAE kernel is unfortunate but it is really hard to do anything about that considering that the kernel and most its allocations have to live in a small and scarce lowmem memory. Moreover the more memory you have to more you have to allocated from that memory. This is why not only Linus hates 32b systems on a large memory systems. -- Michal Hocko SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Trevor Cordes <trevor@tecnopolis.ca> |
|---|---|
| Date | 2017-01-20 07:40 +0100 |
| Message-ID | <t1B1D-3Nl-3@gated-at.bofh.it> |
| In reply to | #1562636 |
[Multipart message — attachments visible in raw view] — view raw
On 2017-01-19 Michal Hocko wrote: > On Thu 19-01-17 03:48:50, Trevor Cordes wrote: > > On 2017-01-17 Michal Hocko wrote: > > > On Tue 17-01-17 14:21:14, Mel Gorman wrote: > > > > On Tue, Jan 17, 2017 at 02:52:28PM +0100, Michal Hocko > > > > wrote: > > > > > On Mon 16-01-17 11:09:34, Mel Gorman wrote: > > > > > [...] > > > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > > > > index 532a2a750952..46aac487b89a 100644 > > > > > > --- a/mm/vmscan.c > > > > > > +++ b/mm/vmscan.c > > > > > > @@ -2684,6 +2684,7 @@ static void shrink_zones(struct > > > > > > zonelist *zonelist, struct scan_control *sc) continue; > > > > > > > > > > > > if (sc->priority != DEF_PRIORITY && > > > > > > + !buffer_heads_over_limit && > > > > > > !pgdat_reclaimable(zone->zone_pgdat)) > > > > > > continue; /* Let > > > > > > kswapd poll it */ > > > > > > > > > > I think we should rather remove pgdat_reclaimable here. This > > > > > sounds like a wrong layer to decide whether we want to reclaim > > > > > and how much. > > > > > > > > I had considered that but it'd also be important to add the > > > > other 32-bit patches you have posted to see the impact. Because > > > > of the ratio of LRU pages to slab pages, it may not have an > > > > impact but it'd need to be eliminated. > > > > > > OK, Trevor you can pull from > > > git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git tree > > > fixes/highmem-node-fixes branch. This contains the current mmotm > > > tree > > > + the latest highmem fixes. I also do not expect this would help > > > much in your case but as Mel've said we should rule that out at > > > least. > > > > Hi! The git tree above version oom'd after < 24 hours (3:02am) so > > it doesn't solve the bug. If you need a oom messages dump let me > > know. > > Yes please. The first oom from that night attached. Note, the oom wasn't as dire with your mhocko/4.9.0+ as it usually is with stock 4.8.x: my oom detector and reboot script was able to do its thing cleanly before the system became unusable. I'll await further instructions and test right away. Maybe I'll try a few tuning ideas until then. Thanks! > > Let me know what to try next, guys, and I'll test it out. > > > > > > Before prototyping such a thing, I'd like to hear the outcome of > > > > this heavy hack and then add your 32-bit patches onto the list. > > > > If the problem is still there then I'd next look at taking slab > > > > pages into account in pgdat_reclaimable() instead of an > > > > outright removal that has a much wider impact. If that doesn't > > > > work then I'll prototype a heavy-handed forced slab reclaim > > > > when lower zones are almost all slab pages. > > > > I don't think I've tried the "heavy hack" patch yet? It's not in > > the mhocko tree I just tried? Should I try the heavy hack on top > > of mhocko git or on vanilla or what? > > > > I also want to mention that these PAE boxes suffer from another > > problem/bug that I've worked around for almost a year now. For some > > reason it keeps gnawing at me that it might be related. The disk > > I/O goes to pot on this/these PAE boxes after a certain amount of > > disk writes (like some unknown number of GB, around 10-ish maybe). > > Like writes go from 500MB/s to 10MB/s!! Reboot and it's magically > > 500MB/s again. I detail this here: > > https://muug.ca/pipermail/roundtable/2016-June/004669.html > > My fix was to mem=XG where X is <8 (like 4 or 6) to force the PAE > > kernel to be more sane about highmem choices. I never filed a bug > > because I read a ton of stuff saying Linus hates PAE, don't use over > > 4G, blah blah. But the other fix is to: > > set /proc/sys/vm/highmem_is_dirtyable to 1 > > Yes this sounds like a dirty memory throttling and there were some > changes in that area. I do not remember when exactly. I think my PAE-slow-IO bug started way back in Fedora 22 (4.0?), hard to know exactly when as I didn't discover the bug for maybe a year as I didn't realize IO was the problem right away. Too late to bisect that one, I guess. I guess it's not related so we can ignore my tangent! > > I'm not bringing this up to get attention to a new bug, I bring > > this up because it smells like it might be related. If something > > slowly eats away at the box's vm to the point that I/O gets > > horribly slow, perhaps it's related to the slab and high/lomem > > issue we have here? And if related, it may help to solve the oom > > bug. If I'm way off base here, just ignore my tangent! > > >From your OOM reports so far it doesn't really seem related because > >you > never had large number of pages under the writeback when OOM. > > The situation with the PAE kernel is unfortunate but it is really hard > to do anything about that considering that the kernel and most its > allocations have to live in a small and scarce lowmem memory. Moreover > the more memory you have to more you have to allocated from that > memory. You're for sure right that the IO-slow bug was definitely worse the more ram was in a system! (The mem=4G really helps alleviate this bug and is good enough for me.) > This is why not only Linus hates 32b systems on a large memory > systems. Completely off-topic: it would be great if rather than pretending PAE should work with large RAM (which seems more broken every day), the kernel guys put out an officially stated policy of a maximum RAM you can use, and try to have the kernel behave for <= that size, and then people could use more RAM but clearly "at your own risk, don't bug us about problems!". Other than a few posts about Linus hating it, there's nothing official I can find about it in documentation, etc. It gives the (mis)impression that it's perfectly fine to run PAE on a zillion GB modern system. Then we later learn the hard way :-)
[toc] | [prev] | [next] | [standalone]
| From | Mel Gorman <mgorman@techsingularity.net> |
|---|---|
| Date | 2017-01-20 12:10 +0100 |
| Message-ID | <t1FeV-6vs-1@gated-at.bofh.it> |
| In reply to | #1563320 |
On Fri, Jan 20, 2017 at 12:35:44AM -0600, Trevor Cordes wrote:
> > > Hi! The git tree above version oom'd after < 24 hours (3:02am) so
> > > it doesn't solve the bug. If you need a oom messages dump let me
> > > know.
> >
> > Yes please.
>
> The first oom from that night attached. Note, the oom wasn't as dire
> with your mhocko/4.9.0+ as it usually is with stock 4.8.x: my oom
> detector and reboot script was able to do its thing cleanly before the
> system became unusable.
>
> I'll await further instructions and test right away. Maybe I'll try a
> few tuning ideas until then. Thanks!
>
Thanks for the OOM report. I was expecting it to be a particular shape and
my expectations were not matched so it took time to consider it further. Can
you try the cumulative patch below? It combines three patches that
1. Allow slab shrinking even if the LRU patches are unreclaimable in
direct reclaim
2. Shrinks slab based once based on the contents of all memcgs instead
of shrinking one at a time
3. Tries to shrink slabs if the lowmem usage is too high
Unfortunately it's only boot tested on x86-64 as I didn't get the chance
to setup an i386 test bed.
> > This is why not only Linus hates 32b systems on a large memory
> > systems.
>
> Completely off-topic: it would be great if rather than pretending PAE
> should work with large RAM (which seems more broken every day), the
> kernel guys put out an officially stated policy of a maximum RAM you
> can use, and try to have the kernel behave for <= that size, and then
> people could use more RAM but clearly "at your own risk, don't bug us
> about problems!". Other than a few posts about Linus hating it,
> there's nothing official I can find about it in documentation, etc. It
> gives the (mis)impression that it's perfectly fine to run PAE on a
> zillion GB modern system. Then we later learn the hard way :-)
The unfortunate reality is that the behaviour is workload dependant so
it's impossible to make a general statement other than "your mileage may
vary considerably".
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2281ad310d06..76d68a8872c7 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2318,6 +2318,52 @@ static void get_scan_count(struct lruvec *lruvec, struct mem_cgroup *memcg,
}
}
+#ifdef CONFIG_HIGHMEM
+static void balance_slab_lowmem(struct pglist_data *pgdat,
+ struct scan_control *sc)
+{
+ unsigned long lru_pages = 0;
+ unsigned long slab_pages = 0;
+ int zid;
+
+ for (zid = 0; zid < MAX_NR_ZONES; zid++) {
+ struct zone *zone = &pgdat->node_zones[zid];
+
+ if (!populated_zone(zone) || !is_highmem_idx(zid))
+ continue;
+
+ lru_pages += zone_page_state(zone, NR_ZONE_INACTIVE_FILE);
+ lru_pages += zone_page_state(zone, NR_ZONE_ACTIVE_FILE);
+ slab_pages += zone_page_state(zone, NR_SLAB_RECLAIMABLE);
+ slab_pages += zone_page_state(zone, NR_SLAB_UNRECLAIMABLE);
+ }
+
+ /*
+ * Shrink reclaimable slabs if the number of lowmem slab pages is
+ * over twice the size of LRU pages. Apply pressure relative to
+ * the imbalance between LRU and slab pages.
+ */
+ if (slab_pages > lru_pages << 1) {
+ struct reclaim_state *reclaim_state = current->reclaim_state;
+ unsigned long exceed = (lru_pages << 1) - slab_pages;
+ int nid = pgdat->node_id;
+
+ exceed = min(exceed, slab_pages);
+ shrink_slab(sc->gfp_mask, nid, NULL, exceed, slab_pages);
+ if (reclaim_state) {
+ sc->nr_reclaimed += reclaim_state->reclaimed_slab;
+ reclaim_state->reclaimed_slab = 0;
+ }
+ }
+}
+#else
+static void balance_slab_lowmem(struct pglist_data *pgdat,
+ struct scan_control *sc)
+{
+ return false;
+}
+#endif
+
/*
* This is a basic per-node page freer. Used by both kswapd and direct reclaim.
*/
@@ -2336,6 +2382,27 @@ static void shrink_node_memcg(struct pglist_data *pgdat, struct mem_cgroup *memc
get_scan_count(lruvec, memcg, sc, nr, lru_pages);
+ /*
+ * If direct reclaiming at elevated priority and the node is
+ * unreclaimable then skip LRU reclaim and let kswapd poll it.
+ */
+ if (!current_is_kswapd() &&
+ sc->priority != DEF_PRIORITY &&
+ !pgdat_reclaimable(pgdat)) {
+ unsigned long nr_scanned;
+
+ /*
+ * Fake scanning so that slab shrinking will continue. For
+ * lowmem restricted allocations, shrink aggressively.
+ */
+ nr_scanned = SWAP_CLUSTER_MAX << (DEF_PRIORITY - sc->priority);
+ if (!(sc->gfp_mask & __GFP_HIGHMEM))
+ nr_scanned = max(nr_scanned, *lru_pages);
+ sc->nr_scanned += nr_scanned;
+
+ return;
+ }
+
/* Record the original scan target for proportional adjustments later */
memcpy(targets, nr, sizeof(nr));
@@ -2369,6 +2436,7 @@ static void shrink_node_memcg(struct pglist_data *pgdat, struct mem_cgroup *memc
}
}
+ balance_slab_lowmem(pgdat, sc);
cond_resched();
if (nr_reclaimed < nr_to_reclaim || scan_adjusted)
@@ -2533,7 +2601,8 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
.pgdat = pgdat,
.priority = sc->priority,
};
- unsigned long node_lru_pages = 0;
+ unsigned long slab_pressure = 0;
+ unsigned long slab_eligible = 0;
struct mem_cgroup *memcg;
nr_reclaimed = sc->nr_reclaimed;
@@ -2555,12 +2624,8 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
scanned = sc->nr_scanned;
shrink_node_memcg(pgdat, memcg, sc, &lru_pages);
- node_lru_pages += lru_pages;
-
- if (memcg)
- shrink_slab(sc->gfp_mask, pgdat->node_id,
- memcg, sc->nr_scanned - scanned,
- lru_pages);
+ slab_eligible += lru_pages;
+ slab_pressure += sc->nr_reclaimed - reclaimed;
/* Record the group's reclaim efficiency */
vmpressure(sc->gfp_mask, memcg, false,
@@ -2586,12 +2651,12 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
/*
* Shrink the slab caches in the same proportion that
- * the eligible LRU pages were scanned.
+ * the eligible LRU pages were scanned. For memcg, this
+ * will apply the cumulative scanning pressure over all
+ * memcgs.
*/
- if (global_reclaim(sc))
- shrink_slab(sc->gfp_mask, pgdat->node_id, NULL,
- sc->nr_scanned - nr_scanned,
- node_lru_pages);
+ shrink_slab(sc->gfp_mask, pgdat->node_id, NULL, slab_pressure,
+ slab_eligible);
if (reclaim_state) {
sc->nr_reclaimed += reclaim_state->reclaimed_slab;
@@ -2683,10 +2748,6 @@ static void shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
GFP_KERNEL | __GFP_HARDWALL))
continue;
- if (sc->priority != DEF_PRIORITY &&
- !pgdat_reclaimable(zone->zone_pgdat))
- continue; /* Let kswapd poll it */
-
/*
* If we already have plenty of memory free for
* compaction in this zone, don't free any more.
[toc] | [prev] | [next] | [standalone]
| From | Mel Gorman <mgorman@techsingularity.net> |
|---|---|
| Date | 2017-01-20 17:00 +0100 |
| Message-ID | <t1JLA-Gk-23@gated-at.bofh.it> |
| In reply to | #1563486 |
On Fri, Jan 20, 2017 at 11:02:32AM +0000, Mel Gorman wrote:
> On Fri, Jan 20, 2017 at 12:35:44AM -0600, Trevor Cordes wrote:
> > > > Hi! The git tree above version oom'd after < 24 hours (3:02am) so
> > > > it doesn't solve the bug. If you need a oom messages dump let me
> > > > know.
> > >
> > > Yes please.
> >
> > The first oom from that night attached. Note, the oom wasn't as dire
> > with your mhocko/4.9.0+ as it usually is with stock 4.8.x: my oom
> > detector and reboot script was able to do its thing cleanly before the
> > system became unusable.
> >
> > I'll await further instructions and test right away. Maybe I'll try a
> > few tuning ideas until then. Thanks!
> >
>
> Thanks for the OOM report. I was expecting it to be a particular shape and
> my expectations were not matched so it took time to consider it further. Can
> you try the cumulative patch below? It combines three patches that
>
> 1. Allow slab shrinking even if the LRU patches are unreclaimable in
> direct reclaim
> 2. Shrinks slab based once based on the contents of all memcgs instead
> of shrinking one at a time
> 3. Tries to shrink slabs if the lowmem usage is too high
>
> Unfortunately it's only boot tested on x86-64 as I didn't get the chance
> to setup an i386 test bed.
>
There was one major flaw in that patch. This version fixes it and
addresses other minor issues. It may still be too agressive shrinking
slab but worth trying out. Thanks.
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2281ad310d06..2c735ea24a85 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2318,6 +2318,59 @@ static void get_scan_count(struct lruvec *lruvec, struct mem_cgroup *memcg,
}
}
+#ifdef CONFIG_HIGHMEM
+static void balance_slab_lowmem(struct pglist_data *pgdat,
+ struct scan_control *sc)
+{
+ unsigned long lru_pages = 0;
+ unsigned long slab_pages = 0;
+ unsigned long managed_pages = 0;
+ int zid;
+
+ for (zid = 0; zid < MAX_NR_ZONES; zid++) {
+ struct zone *zone = &pgdat->node_zones[zid];
+
+ if (!populated_zone(zone) || is_highmem_idx(zid))
+ continue;
+
+ lru_pages += zone_page_state(zone, NR_ZONE_INACTIVE_FILE);
+ lru_pages += zone_page_state(zone, NR_ZONE_ACTIVE_FILE);
+ lru_pages += zone_page_state(zone, NR_ZONE_INACTIVE_ANON);
+ lru_pages += zone_page_state(zone, NR_ZONE_ACTIVE_ANON);
+ slab_pages += zone_page_state(zone, NR_SLAB_RECLAIMABLE);
+ slab_pages += zone_page_state(zone, NR_SLAB_UNRECLAIMABLE);
+ }
+
+ /* Do not balance until LRU and slab exceeds 50% of lowmem */
+ if (lru_pages + slab_pages < (managed_pages >> 1))
+ return;
+
+ /*
+ * Shrink reclaimable slabs if the number of lowmem slab pages is
+ * over twice the size of LRU pages. Apply pressure relative to
+ * the imbalance between LRU and slab pages.
+ */
+ if (slab_pages > lru_pages << 1) {
+ struct reclaim_state *reclaim_state = current->reclaim_state;
+ unsigned long exceed = slab_pages - (lru_pages << 1);
+ int nid = pgdat->node_id;
+
+ exceed = min(exceed, slab_pages);
+ shrink_slab(sc->gfp_mask, nid, NULL, exceed >> 3, slab_pages);
+ if (reclaim_state) {
+ sc->nr_reclaimed += reclaim_state->reclaimed_slab;
+ reclaim_state->reclaimed_slab = 0;
+ }
+ }
+}
+#else
+static void balance_slab_lowmem(struct pglist_data *pgdat,
+ struct scan_control *sc)
+{
+ return;
+}
+#endif
+
/*
* This is a basic per-node page freer. Used by both kswapd and direct reclaim.
*/
@@ -2336,6 +2389,27 @@ static void shrink_node_memcg(struct pglist_data *pgdat, struct mem_cgroup *memc
get_scan_count(lruvec, memcg, sc, nr, lru_pages);
+ /*
+ * If direct reclaiming at elevated priority and the node is
+ * unreclaimable then skip LRU reclaim and let kswapd poll it.
+ */
+ if (!current_is_kswapd() &&
+ sc->priority != DEF_PRIORITY &&
+ !pgdat_reclaimable(pgdat)) {
+ unsigned long nr_scanned;
+
+ /*
+ * Fake scanning so that slab shrinking will continue. For
+ * lowmem restricted allocations, shrink aggressively.
+ */
+ nr_scanned = SWAP_CLUSTER_MAX << (DEF_PRIORITY - sc->priority);
+ if (!(sc->gfp_mask & __GFP_HIGHMEM))
+ nr_scanned = max(nr_scanned, *lru_pages);
+ sc->nr_scanned += nr_scanned;
+
+ return;
+ }
+
/* Record the original scan target for proportional adjustments later */
memcpy(targets, nr, sizeof(nr));
@@ -2435,6 +2509,8 @@ static void shrink_node_memcg(struct pglist_data *pgdat, struct mem_cgroup *memc
if (inactive_list_is_low(lruvec, false, sc, true))
shrink_active_list(SWAP_CLUSTER_MAX, lruvec,
sc, LRU_ACTIVE_ANON);
+
+ balance_slab_lowmem(pgdat, sc);
}
/* Use reclaim/compaction for costly allocs or under memory pressure */
@@ -2533,7 +2609,8 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
.pgdat = pgdat,
.priority = sc->priority,
};
- unsigned long node_lru_pages = 0;
+ unsigned long slab_pressure = 0;
+ unsigned long slab_eligible = 0;
struct mem_cgroup *memcg;
nr_reclaimed = sc->nr_reclaimed;
@@ -2555,12 +2632,8 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
scanned = sc->nr_scanned;
shrink_node_memcg(pgdat, memcg, sc, &lru_pages);
- node_lru_pages += lru_pages;
-
- if (memcg)
- shrink_slab(sc->gfp_mask, pgdat->node_id,
- memcg, sc->nr_scanned - scanned,
- lru_pages);
+ slab_eligible += lru_pages;
+ slab_pressure += sc->nr_reclaimed - reclaimed;
/* Record the group's reclaim efficiency */
vmpressure(sc->gfp_mask, memcg, false,
@@ -2586,12 +2659,12 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
/*
* Shrink the slab caches in the same proportion that
- * the eligible LRU pages were scanned.
+ * the eligible LRU pages were scanned. For memcg, this
+ * will apply the cumulative scanning pressure over all
+ * memcgs.
*/
- if (global_reclaim(sc))
- shrink_slab(sc->gfp_mask, pgdat->node_id, NULL,
- sc->nr_scanned - nr_scanned,
- node_lru_pages);
+ shrink_slab(sc->gfp_mask, pgdat->node_id, NULL, slab_pressure,
+ slab_eligible);
if (reclaim_state) {
sc->nr_reclaimed += reclaim_state->reclaimed_slab;
@@ -2683,10 +2756,6 @@ static void shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
GFP_KERNEL | __GFP_HARDWALL))
continue;
- if (sc->priority != DEF_PRIORITY &&
- !pgdat_reclaimable(zone->zone_pgdat))
- continue; /* Let kswapd poll it */
-
/*
* If we already have plenty of memory free for
* compaction in this zone, don't free any more.
--
Mel Gorman
SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Mel Gorman <mgorman@techsingularity.net> |
|---|---|
| Date | 2017-01-23 11:50 +0100 |
| Message-ID | <t2Kme-5kk-13@gated-at.bofh.it> |
| In reply to | #1563737 |
On Sun, Jan 22, 2017 at 06:45:59PM -0600, Trevor Cordes wrote: > On 2017-01-20 Mel Gorman wrote: > > > > > > Thanks for the OOM report. I was expecting it to be a particular > > > shape and my expectations were not matched so it took time to > > > consider it further. Can you try the cumulative patch below? It > > > combines three patches that > > > > > > 1. Allow slab shrinking even if the LRU patches are unreclaimable in > > > direct reclaim > > > 2. Shrinks slab based once based on the contents of all memcgs > > > instead of shrinking one at a time > > > 3. Tries to shrink slabs if the lowmem usage is too high > > > > > > Unfortunately it's only boot tested on x86-64 as I didn't get the > > > chance to setup an i386 test bed. > > > > > > > There was one major flaw in that patch. This version fixes it and > > addresses other minor issues. It may still be too agressive shrinking > > slab but worth trying out. Thanks. > > I ran with your patch below and it oom'd on the first night. It was > weird, it didn't hang the system, and my rebooter script started a > reboot but the system never got more than half down before it just sat > there in a weird state where a local console user could still login but > not much was working. So the patches don't seem to solve the problem. > > For the above compile I applied your patches to 4.10.0-rc4+, I hope > that's ok. > It would be strongly preferred to run them on top of Michal's other fixes. The main reason it's preferred is because this OOM differs from earlier ones in that it OOM killed from GFP_NOFS|__GFP_NOFAIL context. That meant that the slab shrinking could not happen from direct reclaim so the balancing from my patches would not occur. As Michal's other patches affect how kswapd behaves, it's important. Unfortunately, even that will be race prone for GFP_NOFS callers as they'll effectively be racing to see if kswapd or another direct reclaimer can reclaim before the OOM conditions are hit. It is by design, but it's apparent that a __GFP_NOFAIL request can trigger OOM relatively easily as it's not necessarily throttled or waiting on kswapd to complete any work. I'll keep thinking about it. -- Mel Gorman SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Mel Gorman <mgorman@techsingularity.net> |
|---|---|
| Date | 2017-01-23 12:10 +0100 |
| Message-ID | <t2KFA-5GZ-21@gated-at.bofh.it> |
| In reply to | #1564855 |
On Mon, Jan 23, 2017 at 10:48:58AM +0000, Mel Gorman wrote: > On Sun, Jan 22, 2017 at 06:45:59PM -0600, Trevor Cordes wrote: > > On 2017-01-20 Mel Gorman wrote: > > > > > > > > Thanks for the OOM report. I was expecting it to be a particular > > > > shape and my expectations were not matched so it took time to > > > > consider it further. Can you try the cumulative patch below? It > > > > combines three patches that > > > > > > > > 1. Allow slab shrinking even if the LRU patches are unreclaimable in > > > > direct reclaim > > > > 2. Shrinks slab based once based on the contents of all memcgs > > > > instead of shrinking one at a time > > > > 3. Tries to shrink slabs if the lowmem usage is too high > > > > > > > > Unfortunately it's only boot tested on x86-64 as I didn't get the > > > > chance to setup an i386 test bed. > > > > > > > > > > There was one major flaw in that patch. This version fixes it and > > > addresses other minor issues. It may still be too agressive shrinking > > > slab but worth trying out. Thanks. > > > > I ran with your patch below and it oom'd on the first night. It was > > weird, it didn't hang the system, and my rebooter script started a > > reboot but the system never got more than half down before it just sat > > there in a weird state where a local console user could still login but > > not much was working. So the patches don't seem to solve the problem. > > > > For the above compile I applied your patches to 4.10.0-rc4+, I hope > > that's ok. > > > > It would be strongly preferred to run them on top of Michal's other > fixes. The main reason it's preferred is because this OOM differs from > earlier ones in that it OOM killed from GFP_NOFS|__GFP_NOFAIL context. > That meant that the slab shrinking could not happen from direct reclaim so > the balancing from my patches would not occur. As Michal's other patches > affect how kswapd behaves, it's important. > > Unfortunately, even that will be race prone for GFP_NOFS callers as > they'll effectively be racing to see if kswapd or another direct > reclaimer can reclaim before the OOM conditions are hit. It is by > design, but it's apparent that a __GFP_NOFAIL request can trigger OOM > relatively easily as it's not necessarily throttled or waiting on kswapd > to complete any work. I'll keep thinking about it. > As a slight follow-up albeit without patches, further options are to; 1. In should_reclaim_retry, account for SLAB_RECLAIMABLE as available pages when deciding to retry reclaim 2. Stall in should_reclaim_retry for __GFP_NOFAIL|__GFP_NOFS with a comment stating that the intent is to allow kswapd make progress with the shrinker 3. Stall __GFP_NOFS in direct reclaimer on a workqueue when it's failing to make progress to allow kswapd to do some work. This may be impaired if kswapd is locked up waiting for a lock held by the direct reclaimer 4. Schedule the system workqueue to drain slab for __GFP_NOFS|__GFP_NOFAIL. 3 and 4 are extremely heavy handed so we should try them one at a time. -- Mel Gorman SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-01-25 10:50 +0100 |
| Message-ID | <t3snf-8uI-11@gated-at.bofh.it> |
| In reply to | #1564865 |
On Mon 23-01-17 11:04:12, Mel Gorman wrote: [...] > 1. In should_reclaim_retry, account for SLAB_RECLAIMABLE as available > pages when deciding to retry reclaim I am pretty sure I have considered this but then decided to not go that way. I do not remember details so I will think about this some more. It might have been just "let's wait for the real issue here". Anyway we can give it a try and it would be as simple as diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 94ebd30d0f09..87221491be84 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3566,7 +3566,7 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order, unsigned long min_wmark = min_wmark_pages(zone); bool wmark; - available = reclaimable = zone_reclaimable_pages(zone); + available = reclaimable = zone_reclaimable_pages(zone) + zone_page_state_snapshot(zone, NR_SLAB_RECLAIMABLE); available -= DIV_ROUND_UP((*no_progress_loops) * available, MAX_RECLAIM_RETRIES); available += zone_page_state_snapshot(zone, NR_FREE_PAGES); I am not sure it would really help much on its own without further changes to how we scale LRU->slab scanning. Could you give this a try on top of the mmotm or linux-next tree? > 2. Stall in should_reclaim_retry for __GFP_NOFAIL|__GFP_NOFS with a > comment stating that the intent is to allow kswapd make progress > with the shrinker The current mmotm tree doesnt need this because we no longer trigger the oom killer for this combinations of flags. > 3. Stall __GFP_NOFS in direct reclaimer on a workqueue when it's > failing to make progress to allow kswapd to do some work. This > may be impaired if kswapd is locked up waiting for a lock held > by the direct reclaimer > 4. Schedule the system workqueue to drain slab for > __GFP_NOFS|__GFP_NOFAIL. > > 3 and 4 are extremely heavy handed so we should try them one at a time. I am not even sure they are really necessary. -- Michal Hocko SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-01-24 14:00 +0100 |
| Message-ID | <t38RA-4pJ-17@gated-at.bofh.it> |
| In reply to | #1564855 |
On Mon 23-01-17 10:48:58, Mel Gorman wrote: [...] > Unfortunately, even that will be race prone for GFP_NOFS callers as > they'll effectively be racing to see if kswapd or another direct > reclaimer can reclaim before the OOM conditions are hit. It is by > design, but it's apparent that a __GFP_NOFAIL request can trigger OOM > relatively easily as it's not necessarily throttled or waiting on kswapd > to complete any work. I'll keep thinking about it. Yes, we shouldn't trigger the OOM for GFP_NOFS as the memory reclaim is really weaker. And that might really matter here. So the mmomt tree will behave differently in this regards as we have [1] [1] http://lkml.kernel.org/r/20161220134904.21023-3-mhocko@kernel.org -- Michal Hocko SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Trevor Cordes <trevor@tecnopolis.ca> |
|---|---|
| Date | 2017-01-25 11:30 +0100 |
| Message-ID | <t3sZY-wo-47@gated-at.bofh.it> |
| In reply to | #1564855 |
[Multipart message — attachments visible in raw view] — view raw
On 2017-01-23 Mel Gorman wrote:
> On Sun, Jan 22, 2017 at 06:45:59PM -0600, Trevor Cordes wrote:
> > On 2017-01-20 Mel Gorman wrote:
> > > >
> > > > Thanks for the OOM report. I was expecting it to be a particular
> > > > shape and my expectations were not matched so it took time to
> > > > consider it further. Can you try the cumulative patch below? It
> > > > combines three patches that
> > > >
> > > > 1. Allow slab shrinking even if the LRU patches are
> > > > unreclaimable in direct reclaim
> > > > 2. Shrinks slab based once based on the contents of all memcgs
> > > > instead of shrinking one at a time
> > > > 3. Tries to shrink slabs if the lowmem usage is too high
> > > >
> > > > Unfortunately it's only boot tested on x86-64 as I didn't get
> > > > the chance to setup an i386 test bed.
> > > >
> > >
> > > There was one major flaw in that patch. This version fixes it and
> > > addresses other minor issues. It may still be too agressive
> > > shrinking slab but worth trying out. Thanks.
> >
> > I ran with your patch below and it oom'd on the first night. It was
> > weird, it didn't hang the system, and my rebooter script started a
> > reboot but the system never got more than half down before it just
> > sat there in a weird state where a local console user could still
> > login but not much was working. So the patches don't seem to solve
> > the problem.
> >
> > For the above compile I applied your patches to 4.10.0-rc4+, I hope
> > that's ok.
> >
>
> It would be strongly preferred to run them on top of Michal's other
> fixes. The main reason it's preferred is because this OOM differs from
> earlier ones in that it OOM killed from GFP_NOFS|__GFP_NOFAIL context.
> That meant that the slab shrinking could not happen from direct
> reclaim so the balancing from my patches would not occur. As
> Michal's other patches affect how kswapd behaves, it's important.
OK, I patched & compiled mhocko's git tree from the other day 4.9.0+.
(To confirm, weird, but mhocko's git tree I'm using from a couple of
weeks ago shows the newest commit (git log) is
69973b830859bc6529a7a0468ba0d80ee5117826 "Linux 4.9"? Let me know if
I'm doing something wrong, see below.)
Anyhow, it oom'd as usual at ~3am, system froze after 20 ooms hit in 7
secs. So no help there. Attached is the oom log from the first oom
hit.
On 2017-01-24 Michal Hocko wrote:
> On Sun 22-01-17 18:45:59, Trevor Cordes wrote:
> [...]
> > Also, completely separate from your patch I ran mhocko's 4.9 tree
> > with mem=2G to see if lower ram amount would help, but it didn't.
> > Even with 2G the system oom and hung same as usual. So far the
> > only thing that helps at all was the cgroup_disable=memory option,
> > which makes the problem disappear completely for me.
>
> OK, can we reduce the problem space slightly more and could you boot
> with kmem accounting enabled? cgroup.memory=nokmem,nosocket
I will try that right now, I'll use the mhocko git tree without Mel's
emailed patch, and I'll refresh the git tree from origin first (let me
know that's a bad move). As usual, I'll report back within 24-48 hours.
Actually, on my tests with mhocko git tree, I'm a bit confused and want
to make sure I'm compiling the right thing. His tree doesn't seem to
have recent commits? I did "git fetch origin" and "git reset --hard
origin/master" to refresh the tree just now and the latest commit is
still the one shown above "Linux 4.9"? Is Michal making changes but
not comitting? How do I ensure I'm compiling the version you guys want
me to test? ("git log mm/vmscan.c" shows newest commit is Dec 2??) Am
I supposed to be testing a specific branch?
If I've been testing the wrong branch, this *only* affects my mhocko
tree tests (not the vanilla or fedora-patched tests). Thankfully I
think I've only done 1 or 2 mhocko tree tests, and I can easily redo
them. If this turns out to be the case, I'm so sorry for the
confusion, the non-vanilla git tree thing is all new to me.
In any event, I'm still trying the above, and will adjust if necessary
if it's confirmed I'm doing something wrong with the mhocko git tree.
Thanks!
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-01-25 13:10 +0100 |
| Message-ID | <t3uyJ-1AH-9@gated-at.bofh.it> |
| In reply to | #1566462 |
On Wed 25-01-17 04:02:46, Trevor Cordes wrote: > On 2017-01-23 Mel Gorman wrote: > > On Sun, Jan 22, 2017 at 06:45:59PM -0600, Trevor Cordes wrote: > > > On 2017-01-20 Mel Gorman wrote: > > > > > > > > > > Thanks for the OOM report. I was expecting it to be a particular > > > > > shape and my expectations were not matched so it took time to > > > > > consider it further. Can you try the cumulative patch below? It > > > > > combines three patches that > > > > > > > > > > 1. Allow slab shrinking even if the LRU patches are > > > > > unreclaimable in direct reclaim > > > > > 2. Shrinks slab based once based on the contents of all memcgs > > > > > instead of shrinking one at a time > > > > > 3. Tries to shrink slabs if the lowmem usage is too high > > > > > > > > > > Unfortunately it's only boot tested on x86-64 as I didn't get > > > > > the chance to setup an i386 test bed. > > > > > > > > > > > > > There was one major flaw in that patch. This version fixes it and > > > > addresses other minor issues. It may still be too agressive > > > > shrinking slab but worth trying out. Thanks. > > > > > > I ran with your patch below and it oom'd on the first night. It was > > > weird, it didn't hang the system, and my rebooter script started a > > > reboot but the system never got more than half down before it just > > > sat there in a weird state where a local console user could still > > > login but not much was working. So the patches don't seem to solve > > > the problem. > > > > > > For the above compile I applied your patches to 4.10.0-rc4+, I hope > > > that's ok. > > > > > > > It would be strongly preferred to run them on top of Michal's other > > fixes. The main reason it's preferred is because this OOM differs from > > earlier ones in that it OOM killed from GFP_NOFS|__GFP_NOFAIL context. > > That meant that the slab shrinking could not happen from direct > > reclaim so the balancing from my patches would not occur. As > > Michal's other patches affect how kswapd behaves, it's important. > > OK, I patched & compiled mhocko's git tree from the other day 4.9.0+. > (To confirm, weird, but mhocko's git tree I'm using from a couple of > weeks ago shows the newest commit (git log) is > 69973b830859bc6529a7a0468ba0d80ee5117826 "Linux 4.9"? Let me know if > I'm doing something wrong, see below.) My fault. I should have noted that you should use since-4.9 branch. -- Michal Hocko SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Trevor Cordes <trevor@tecnopolis.ca> |
|---|---|
| Date | 2017-01-30 00:00 +0100 |
| Message-ID | <t56BX-4yH-15@gated-at.bofh.it> |
| In reply to | #1566544 |
On 2017-01-25 Michal Hocko wrote:
> On Wed 25-01-17 04:02:46, Trevor Cordes wrote:
> > OK, I patched & compiled mhocko's git tree from the other day
> > 4.9.0+. (To confirm, weird, but mhocko's git tree I'm using from a
> > couple of weeks ago shows the newest commit (git log) is
> > 69973b830859bc6529a7a0468ba0d80ee5117826 "Linux 4.9"? Let me know
> > if I'm doing something wrong, see below.)
>
> My fault. I should have noted that you should use since-4.9 branch.
OK, I have good news. I compiled your mhocko git tree (properly this
tim!) using since-4.9 branch (last commit
ca63ff9b11f958efafd8c8fa60fda14baec6149c Jan 25) and the box survived 3
3am's, over 60 hours, and I made sure all the usual oom culprits ran,
and I ran extras (finds on the whole tree, extra rdiff-backups) to try
to tax it. Based on my previous criteria I would say your since-4.9 as
of the above commit solves my bug, at least over a 3 day test span
(which it never survives when the bug is present)!
I tested WITHOUT any cgroup/mem boot options. I do still have my
mem=6G limiter on, though (I've never tested with it off, until I solve
the bug with it on, since I've had it on for many months for other
reasons).
On 2017-01-27 Michal Hocko wrote:
> OK, that matches the theory that these OOMs are caused by the
> incorrect active list aging fixed by b4536f0c829c ("mm, memcg: fix
> the active list aging for lowmem requests when memcg is enabled")
b4536f0c829c isn't in the since-4.9 I tested above though? So
something else you did must have fixed it (also)? I don't think I've
run any tests yet with b4536f0c829c in them? I think the vanillas I
was doing a couple of weeks ago were before b4536f0c829c, but I can't
be sure.
What do I test next? Does the since-4.9 stuff get pushed into vanilla
(4.9 hopefully?) so it can find its way into Fedora's stuck F24
kernel?
I want to also note that the RHBZ
https://bugzilla.redhat.com/show_bug.cgi?id=1401012 is garnering more
interest as more people start me-too'ing. The situation is almost
always the same: large rsync's or similar tree-scan accesses cause oom
on PAE boxes. However, I wanted to note that many people there reported
that cgroup_disable=memory doesn't fix anything for them, whereas that
always makes the problem go away on my boxes. Strange.
Thanks Michal and Mel, I really appreciate it!
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-01-30 09:00 +0100 |
| Message-ID | <t5f2x-1hX-5@gated-at.bofh.it> |
| In reply to | #1569304 |
On Sun 29-01-17 16:50:03, Trevor Cordes wrote:
> On 2017-01-25 Michal Hocko wrote:
> > On Wed 25-01-17 04:02:46, Trevor Cordes wrote:
> > > OK, I patched & compiled mhocko's git tree from the other day
> > > 4.9.0+. (To confirm, weird, but mhocko's git tree I'm using from a
> > > couple of weeks ago shows the newest commit (git log) is
> > > 69973b830859bc6529a7a0468ba0d80ee5117826 "Linux 4.9"? Let me know
> > > if I'm doing something wrong, see below.)
> >
> > My fault. I should have noted that you should use since-4.9 branch.
>
> OK, I have good news. I compiled your mhocko git tree (properly this
> tim!) using since-4.9 branch (last commit
> ca63ff9b11f958efafd8c8fa60fda14baec6149c Jan 25) and the box survived 3
> 3am's, over 60 hours, and I made sure all the usual oom culprits ran,
> and I ran extras (finds on the whole tree, extra rdiff-backups) to try
> to tax it. Based on my previous criteria I would say your since-4.9 as
> of the above commit solves my bug, at least over a 3 day test span
> (which it never survives when the bug is present)!
>
> I tested WITHOUT any cgroup/mem boot options. I do still have my
> mem=6G limiter on, though (I've never tested with it off, until I solve
> the bug with it on, since I've had it on for many months for other
> reasons).
Good news indeed.
>
> On 2017-01-27 Michal Hocko wrote:
> > OK, that matches the theory that these OOMs are caused by the
> > incorrect active list aging fixed by b4536f0c829c ("mm, memcg: fix
> > the active list aging for lowmem requests when memcg is enabled")
>
> b4536f0c829c isn't in the since-4.9 I tested above though?
Yes this is a sha1 from Linus tree. The same commit is in the since-4.9
branch under 0759e73ee689f2066a4d64dd90ec5cc3fed28f86. There are some
more fixes on top of course.
> So
> something else you did must have fixed it (also)? I don't think I've
> run any tests yet with b4536f0c829c in them? I think the vanillas I
> was doing a couple of weeks ago were before b4536f0c829c, but I can't
> be sure.
>
> What do I test next? Does the since-4.9 stuff get pushed into vanilla
> (4.9 hopefully?) so it can find its way into Fedora's stuck F24
> kernel?
Testing with Valinall rc6 released just yesterday would be a good fit.
There are some more fixes sitting on mmotm on top and maybe we want some of them
in finall 4.10. Anyway all those pending changes should be merged in the
next merge window - aka 4.11
> I want to also note that the RHBZ
> https://bugzilla.redhat.com/show_bug.cgi?id=1401012 is garnering more
> interest as more people start me-too'ing. The situation is almost
> always the same: large rsync's or similar tree-scan accesses cause oom
> on PAE boxes.
I believe your instructions in comment 20 covers it nicely. If the
problem still persists with the current mmotm tree I would suggest
writing to the mailing list (feel free to CC me) and we will have a
look. Thanks!
> However, I wanted to note that many people there reported
> that cgroup_disable=memory doesn't fix anything for them, whereas that
> always makes the problem go away on my boxes. Strange.
>
> Thanks Michal and Mel, I really appreciate it!
--
Michal Hocko
SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Mel Gorman <mgorman@techsingularity.net> |
|---|---|
| Date | 2017-01-30 10:20 +0100 |
| Message-ID | <t5ghY-2bl-3@gated-at.bofh.it> |
| In reply to | #1569304 |
On Sun, Jan 29, 2017 at 04:50:03PM -0600, Trevor Cordes wrote: > On 2017-01-25 Michal Hocko wrote: > > On Wed 25-01-17 04:02:46, Trevor Cordes wrote: > > > OK, I patched & compiled mhocko's git tree from the other day > > > 4.9.0+. (To confirm, weird, but mhocko's git tree I'm using from a > > > couple of weeks ago shows the newest commit (git log) is > > > 69973b830859bc6529a7a0468ba0d80ee5117826 "Linux 4.9"? Let me know > > > if I'm doing something wrong, see below.) > > > > My fault. I should have noted that you should use since-4.9 branch. > > OK, I have good news. I compiled your mhocko git tree (properly this > tim!) using since-4.9 branch (last commit > ca63ff9b11f958efafd8c8fa60fda14baec6149c Jan 25) and the box survived 3 > 3am's, over 60 hours, and I made sure all the usual oom culprits ran, > and I ran extras (finds on the whole tree, extra rdiff-backups) to try > to tax it. Based on my previous criteria I would say your since-4.9 as > of the above commit solves my bug, at least over a 3 day test span > (which it never survives when the bug is present)! > That's good news. It means the more extreme options may not be necessary. > I tested WITHOUT any cgroup/mem boot options. I do still have my > mem=6G limiter on, though (I've never tested with it off, until I solve > the bug with it on, since I've had it on for many months for other > reasons). > It may be an option to try relaxing that and see at what point it fails. You may find at some point that memory is not utilised as there is not enough lowmem for metadata to track data in highmem. That's not unexpected. > What do I test next? Does the since-4.9 stuff get pushed into vanilla > (4.9 hopefully?) so it can find its way into Fedora's stuck F24 > kernel? > Michal has already made suggestions here and I've nothing to add. > I want to also note that the RHBZ > https://bugzilla.redhat.com/show_bug.cgi?id=1401012 is garnering more > interest as more people start me-too'ing. The situation is almost > always the same: large rsync's or similar tree-scan accesses cause oom > on PAE boxes. However, I wanted to note that many people there reported > that cgroup_disable=memory doesn't fix anything for them, whereas that > always makes the problem go away on my boxes. Strange. > It could simply be down to whether memcgs were actually in use or not. > Thanks Michal and Mel, I really appreciate it! I appreciate the detailed testing and reporting! -- Mel Gorman SUSE Labs
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web