From 48c91e1d7f12d7f924b509d85c51a8255d038c1d Mon Sep 17 00:00:00 2001 From: espie Date: Thu, 10 Jan 2013 10:30:13 +0000 Subject: [PATCH] 'memoryhog' property: avoid starting two such jobs on the same host, if possible (mostly to be used for moz stuff which gobbles huge amounts of memory while linking) --- infrastructure/lib/DPB/Engine.pm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/infrastructure/lib/DPB/Engine.pm b/infrastructure/lib/DPB/Engine.pm index 46845273f9f..831977d560d 100644 --- a/infrastructure/lib/DPB/Engine.pm +++ b/infrastructure/lib/DPB/Engine.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Engine.pm,v 1.70 2013/01/10 10:28:29 espie Exp $ +# $OpenBSD: Engine.pm,v 1.71 2013/01/10 10:30:13 espie Exp $ # # Copyright (c) 2010 Marc Espie # @@ -139,6 +139,10 @@ sub start $self->log('^', $v); next; } + if ($self->check_for_memory_hogs($v, $core)) { + push(@mismatches, $v); + next; + } # keep affinity mismatches for later if (defined $v->{affinity} && !$core->matches($v->{affinity})) { $self->log('A', $v, @@ -224,6 +228,11 @@ sub dump # $self->{queue}->dump($k, $fh); } +sub check_for_memory_hogs +{ + return 0; +} + package DPB::SubEngine::Build; our @ISA = qw(DPB::SubEngine); sub new @@ -343,6 +352,19 @@ sub end_build $self->{engine}{heuristics}->finish_special($v); } +sub check_for_memory_hogs +{ + my ($self, $v, $core) = @_; + if ($v->{info}->has_property('memoryhog')) { + for my $job ($core->same_host_jobs) { + if ($job->{v}{info}->has_property('memoryhog')) { + return 1; + } + } + } + return 0; +} + # for fetch-only, we do the same as Build, except we're never happy package DPB::SubEngine::NoBuild;