Print this page
re #13613 rb4516 Tunables needs volatile keyword

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/tcp/tcp_misc.c
          +++ new/usr/src/uts/common/inet/tcp/tcp_misc.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  24   25   */
  25   26  
  26   27  #include <sys/types.h>
  27   28  #include <sys/strlog.h>
  28   29  #include <sys/policy.h>
  29   30  #include <sys/strsun.h>
  30   31  #include <sys/squeue_impl.h>
  31   32  #include <sys/squeue.h>
       33 +#include <sys/vmsystm.h>
  32   34  
  33   35  #include <inet/common.h>
  34   36  #include <inet/ip.h>
  35   37  #include <inet/tcp.h>
  36   38  #include <inet/tcp_impl.h>
  37   39  
  38   40  /* Control whether TCP can enter defensive mode when under memory pressure. */
  39   41  static boolean_t tcp_do_reclaim = B_TRUE;
  40   42  
  41   43  /*
↓ open down ↓ 455 lines elided ↑ open up ↑
 497  499  
 498  500  /*
 499  501   * Timeout function to reset the TCP stack variable tcps_reclaim to false.
 500  502   */
 501  503  void
 502  504  tcp_reclaim_timer(void *arg)
 503  505  {
 504  506          tcp_stack_t *tcps = (tcp_stack_t *)arg;
 505  507          int64_t tot_conn = 0;
 506  508          int i;
 507      -        extern pgcnt_t lotsfree, needfree;
 508  509  
 509  510          for (i = 0; i < tcps->tcps_sc_cnt; i++)
 510  511                  tot_conn += tcps->tcps_sc[i]->tcp_sc_conn_cnt;
 511  512  
 512  513          /*
 513  514           * This happens only when a stack is going away.  tcps_reclaim_tid
 514  515           * should not be reset to 0 when returning in this case.
 515  516           */
 516  517          mutex_enter(&tcps->tcps_reclaim_lock);
 517  518          if (!tcps->tcps_reclaim) {
↓ open down ↓ 21 lines elided ↑ open up ↑
 539  540   * TCP will also not accept new connection request for those listeners whose
 540  541   * q or q0 is not empty.
 541  542   */
 542  543  /* ARGSUSED */
 543  544  void
 544  545  tcp_conn_reclaim(void *arg)
 545  546  {
 546  547          netstack_handle_t nh;
 547  548          netstack_t *ns;
 548  549          tcp_stack_t *tcps;
 549      -        extern pgcnt_t lotsfree, needfree;
 550  550  
 551  551          if (!tcp_do_reclaim)
 552  552                  return;
 553  553  
 554  554          /*
 555  555           * The reclaim function may be called even when the system is not
 556  556           * really under memory pressure.
 557  557           */
 558  558          if (freemem >= lotsfree + needfree)
 559  559                  return;
↓ open down ↓ 216 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX