Given a family L of graphs, set p = p(L) = min(Lis an element ofL) chi(L) - 1 and, for n greater than or equal to 1, denote by P(n, L) the set of graphs with vertex set [n] containing no member of L as a subgraph, and write ex(n, L) for the maximal size of a member of P(n, L). Extending a result of Erdos, Frankl and Rodl (Graphs Combin. 2 (1986) 113), we prove that \P(n, L)\ less than or equal to 2(1/2(1-1/p)n2+O(n2-r)) for some constant gamma = gamma(L) > 0, and characterize gamma in terms of some related extremal graph problems. In fact, if ex(n, L) = O(n(2-delta)), then any gamma < delta will do. Our proof is based on Szemeredi's Regularity Lemma and the stability theorem of Erdos and Simonovits. The bound above is essentially best possible. (C) 2003 Elsevier Inc. All rights reserved.