diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2015-06-19 12:04:40 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2015-06-19 12:04:40 +0000 |
commit | cc83205849ec369cb9b1302db15caa6273d85b7f (patch) | |
tree | e6563cee0a47a9c03ef01a568b81006e7fc59ab9 | |
parent | 71a2c1322ddfa24e8a0bcefb555d67dea9aca8f8 (diff) | |
parent | 3f2b8a52377413f4fdd822ed4aa046ba5eff81d9 (diff) | |
download | illumos-joyent-cc83205849ec369cb9b1302db15caa6273d85b7f.tar.gz |
[illumos-gate merge]
commit 3f2b8a52377413f4fdd822ed4aa046ba5eff81d9
5974 kmem: remove a check that's always false
commit 0c833d6473a8b5e01ef9b7bc9ac547c0a016f932
5973 kmem: double-calling kmem_depot_ws_update isn't obvious
commit 9321cd0436261240311eaac9aad60ee764e089e6
5972 kmem: fix comment typo
commit 17723245e5b42ca8abb9964a36c0b051c0b237fe
3727 british people can't spell
-rw-r--r-- | usr/src/cmd/spell/spellprog.c | 94 | ||||
-rw-r--r-- | usr/src/uts/common/os/kmem.c | 43 |
2 files changed, 86 insertions, 51 deletions
diff --git a/usr/src/cmd/spell/spellprog.c b/usr/src/cmd/spell/spellprog.c index 82bb35f4fd..7635f86786 100644 --- a/usr/src/cmd/spell/spellprog.c +++ b/usr/src/cmd/spell/spellprog.c @@ -20,6 +20,7 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -27,8 +28,6 @@ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdlib.h> #include <unistd.h> #include <limits.h> @@ -58,7 +57,6 @@ static int ize(char *, char *, char *, int); static int tion(char *, char *, char *, int); static int an(char *, char *, char *, int); int prime(char *); -static void ise(void); static int tryword(char *, char *, int); static int trypref(char *, char *, int); static int trysuff(char *, int); @@ -67,9 +65,8 @@ static int dict(char *, char *); static int monosyl(char *, char *); static int VCe(char *, char *, char *, int); static char *skipv(char *); -static void ztos(char *); -static struct suftab { +struct suftab { char *suf; int (*p1)(); int n1; @@ -79,7 +76,9 @@ static struct suftab { int n2; char *d2; char *a2; -} suftab[] = { +}; + +static struct suftab sufa[] = { {"ssen", ily, 4, "-y+iness", "+ness" }, {"ssel", ily, 4, "-y+i+less", "+less" }, {"se", s, 1, "", "+s", es, 2, "-y+ies", "+es" }, @@ -129,6 +128,56 @@ static struct suftab { 0 }; +static struct suftab sufb[] = { + {"ssen", ily, 4, "-y+iness", "+ness" }, + {"ssel", ily, 4, "-y+i+less", "+less" }, + {"se", s, 1, "", "+s", es, 2, "-y+ies", "+es" }, + {"s'", s, 2, "", "+'s"}, + {"s", s, 1, "", "+s"}, + {"ecn", subst, 1, "-t+ce", ""}, + {"ycn", subst, 1, "-t+cy", ""}, + {"ytilb", nop, 0, "", ""}, + {"ytilib", bility, 5, "-le+ility", ""}, + {"elbaif", i_to_y, 4, "-y+iable", ""}, + {"elba", CCe, 4, "-e+able", "+able"}, + {"yti", CCe, 3, "-e+ity", "+ity"}, + {"ylb", y_to_e, 1, "-e+y", ""}, + {"yl", ily, 2, "-y+ily", "+ly"}, + {"laci", strip, 2, "", "+al"}, + {"latnem", strip, 2, "", "+al"}, + {"lanoi", strip, 2, "", "+al"}, + {"tnem", strip, 4, "", "+ment"}, + {"gni", CCe, 3, "-e+ing", "+ing"}, + {"reta", nop, 0, "", ""}, + {"retc", nop, 0, "", ""}, + {"re", strip, 1, "", "+r", i_to_y, 2, "-y+ier", "+er"}, + {"de", strip, 1, "", "+d", i_to_y, 2, "-y+ied", "+ed"}, + {"citsi", strip, 2, "", "+ic"}, + {"citi", ize, 1, "-ic+e", ""}, + {"cihparg", i_to_y, 1, "-y+ic", ""}, + {"tse", strip, 2, "", "+st", i_to_y, 3, "-y+iest", "+est"}, + {"cirtem", i_to_y, 1, "-y+ic", ""}, + {"yrtem", subst, 0, "-er+ry", ""}, + {"cigol", i_to_y, 1, "-y+ic", ""}, + {"tsigol", i_to_y, 2, "-y+ist", ""}, + {"tsi", CCe, 3, "-e+ist", "+ist"}, + {"msi", CCe, 3, "-e+ism", "+ist"}, + {"noitacifi", i_to_y, 6, "-y+ication", ""}, + {"noitasi", ize, 4, "-e+ation", ""}, + {"rota", tion, 2, "-e+or", ""}, + {"rotc", tion, 2, "", "+or"}, + {"noit", tion, 3, "-e+ion", "+ion"}, + {"naino", an, 3, "", "+ian"}, + {"na", an, 1, "", "+n"}, + {"evi", subst, 0, "-ion+ive", ""}, + {"esi", CCe, 3, "-e+ise", "+ise"}, + {"pihs", strip, 4, "", "+ship"}, + {"dooh", ily, 4, "-y+ihood", "+hood"}, + {"luf", ily, 3, "-y+iful", "+ful"}, + {"ekil", strip, 4, "", "+like"}, + 0 +}; + static char *preftab[] = { "anti", "auto", @@ -173,8 +222,10 @@ static char *preftab[] = { 0 }; +static int bflag; static int vflag; static int xflag; +static struct suftab *suftab; static char *prog; static char word[LINE_MAX]; static char original[LINE_MAX]; @@ -253,7 +304,7 @@ main(int argc, char **argv) while ((c = getopt(argc, argv, "bvx")) != EOF) { switch (c) { case 'b': - ise(); + bflag++; break; case 'v': vflag++; @@ -275,6 +326,9 @@ main(int argc, char **argv) argc--; argv++; + /* Select the correct suffix table */ + suftab = (bflag == 0) ? sufa : sufb; + /* * if pass is not 1, it is assumed to be a filename. * found words are written to this file. @@ -355,12 +409,13 @@ trysuff(char *ep, int lev) lev += DLEV; deriv[lev] = deriv[lev-1] = 0; - for (t = &suftab[0]; (sp = t->suf) != 0; t++) { + for (t = &suftab[0]; (t != 0 && (sp = t->suf) != 0); t++) { cp = ep; while (*sp) if (*--cp != *sp++) goto next; - for (sp = cp; --sp >= word && !vowel(*sp); ); + for (sp = cp; --sp >= word && !vowel(*sp); ) + ; if (sp < word) return (0); if ((*t->p1)(ep-t->n1, t->d1, t->a1, lev+1)) @@ -703,27 +758,6 @@ vowel(int c) return (0); } -/* crummy way to Britishise */ -static void -ise(void) -{ - struct suftab *p; - - for (p = suftab; p->suf; p++) { - ztos(p->suf); - ztos(p->d1); - ztos(p->a1); - } -} - -static void -ztos(char *s) -{ - for (; *s; s++) - if (*s == 'z') - *s = 's'; -} - static int dict(char *bp, char *ep) { diff --git a/usr/src/uts/common/os/kmem.c b/usr/src/uts/common/os/kmem.c index 9d38183ce1..37d28c42de 100644 --- a/usr/src/uts/common/os/kmem.c +++ b/usr/src/uts/common/os/kmem.c @@ -21,6 +21,7 @@ /* * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015 Joyent, Inc. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ /* @@ -2179,6 +2180,21 @@ kmem_depot_ws_update(kmem_cache_t *cp) } /* + * Set the working set statistics for cp's depot to zero. (Everything is + * eligible for reaping.) + */ +static void +kmem_depot_ws_zero(kmem_cache_t *cp) +{ + mutex_enter(&cp->cache_depot_lock); + cp->cache_full.ml_reaplimit = cp->cache_full.ml_total; + cp->cache_full.ml_min = cp->cache_full.ml_total; + cp->cache_empty.ml_reaplimit = cp->cache_empty.ml_total; + cp->cache_empty.ml_min = cp->cache_empty.ml_total; + mutex_exit(&cp->cache_depot_lock); +} + +/* * Reap all magazines that have fallen out of the depot's working set. */ static void @@ -3204,9 +3220,9 @@ kmem_reap_common(void *flag_arg) /* * It may not be kosher to do memory allocation when a reap is called - * is called (for example, if vmem_populate() is in the call chain). - * So we start the reap going with a TQ_NOALLOC dispatch. If the - * dispatch fails, we reset the flag, and the next reap will try again. + * (for example, if vmem_populate() is in the call chain). So we + * start the reap going with a TQ_NOALLOC dispatch. If the dispatch + * fails, we reset the flag, and the next reap will try again. */ if (!taskq_dispatch(kmem_taskq, kmem_reap_start, flag, TQ_NOALLOC)) *flag = 0; @@ -3271,14 +3287,7 @@ kmem_cache_magazine_purge(kmem_cache_t *cp) kmem_magazine_destroy(cp, pmp, prounds); } - /* - * Updating the working set statistics twice in a row has the - * effect of setting the working set size to zero, so everything - * is eligible for reaping. - */ - kmem_depot_ws_update(cp); - kmem_depot_ws_update(cp); - + kmem_depot_ws_zero(cp); kmem_depot_ws_reap(cp); } @@ -3303,16 +3312,14 @@ kmem_cache_magazine_enable(kmem_cache_t *cp) } /* - * Reap (almost) everything right now. See kmem_cache_magazine_purge() - * for explanation of the back-to-back kmem_depot_ws_update() calls. + * Reap (almost) everything right now. */ void kmem_cache_reap_now(kmem_cache_t *cp) { ASSERT(list_link_active(&cp->cache_link)); - kmem_depot_ws_update(cp); - kmem_depot_ws_update(cp); + kmem_depot_ws_zero(cp); (void) taskq_dispatch(kmem_taskq, (task_func_t *)kmem_depot_ws_reap, cp, TQ_SLEEP); @@ -4362,12 +4369,6 @@ kmem_init(void) kstat_init(); /* - * Small-memory systems (< 24 MB) can't handle kmem_flags overhead. - */ - if (physmem < btop(24 << 20) && !(old_kmem_flags & KMF_STICKY)) - kmem_flags = 0; - - /* * Don't do firewalled allocations if the heap is less than 1TB * (i.e. on a 32-bit kernel) * The resulting VM_NEXTFIT allocations would create too much |